Regex Ignoring New Lines
Posted: Mon Jul 25, 2016 2:38 pm
Hi guys,
I have a windows formatted text file (\r\n) that I am reading into a switch script.
Here is an example of the format:
When I try to extract the text in value one using /Value 1\: (.+)/ it starts where I'd expect it to, but it continues on to the end of the file rather than to the end of the line.
I've tried converting the \r\n to \n as well as explicitly saying /Value 1\: (.+)\r\n/ or /Value 1\: (.+)$/ but it just isn't playing ball.
Does anyone have any idea how to get around this?
I am using var jobTicket = File.read(job.getPath() to get my text file into Switch, if that makes any difference.
I have a windows formatted text file (\r\n) that I am reading into a switch script.
Here is an example of the format:
Code: Select all
=======Section A=======
Value 1: I need this value
Value 2: I need this value
Value 3: I need this value
=======Section B=======
Value 4:
I need
all of
these values
Value 5: And this one too!
I've tried converting the \r\n to \n as well as explicitly saying /Value 1\: (.+)\r\n/ or /Value 1\: (.+)$/ but it just isn't playing ball.
Does anyone have any idea how to get around this?
I am using var jobTicket = File.read(job.getPath() to get my text file into Switch, if that makes any difference.