How do you find complete ways that pass through an area

Hello, this may be a specific question but,

I’m looking to identify railway lines that pass through the region of “Pays de la Loire” in France, but I also need them to extend beyond the region itself.

Essentially, what I want to happen is that any railway line which happens to go through the region to be displayed in full, until it reaches either a city or merges with another line, and ends.

I’ve managed to get the railway line in Pays de la Loire, but they cut off when the hit the edge of the region; as the bounding box is set to just Pays de la Loire.

[out:json];
area["name"="Pays de la Loire"]->.pdl;
way["railway"~"rail|light_rail"](area.pdl);
(._;>;);
out body;