A
arfinmail
I was trying to extract the file name from a string like this:
aLine = "c:\\temp\\myFile.txt"
I found a regular expression for pearl which I modified to /[^\\]+$/
and it worked. Can anyone please explain this expression? I really
can't make sense of it
The way I look at it it's searching for the beginning of the file or a
slash, immediatly followed by the end of the string. But it's clearly
not what's happening.
I'm going to look for a way of doing it with the File object for
learning purposes
Another question: Given a string, is there a way to get all characters
between XXX and YYY but only if it does not contain the pattern ZZZ in
the middle?
Ex:
"This-XXX-is-an-YYY-example." => True
"This-XXX-is-ZZZ-an-YYY-example." => False
aLine = "c:\\temp\\myFile.txt"
I found a regular expression for pearl which I modified to /[^\\]+$/
and it worked. Can anyone please explain this expression? I really
can't make sense of it
The way I look at it it's searching for the beginning of the file or a
slash, immediatly followed by the end of the string. But it's clearly
not what's happening.
I'm going to look for a way of doing it with the File object for
learning purposes
Another question: Given a string, is there a way to get all characters
between XXX and YYY but only if it does not contain the pattern ZZZ in
the middle?
Ex:
"This-XXX-is-an-YYY-example." => True
"This-XXX-is-ZZZ-an-YYY-example." => False