Perl REGX match between parentheses
I have a script that reads a file that looks as such.
First(James) Zip(1234) Last(Jones) I have function that you pass a item to find (such as "First"). A simple regex parses the file and returns the data. /$data\((w+)\)/ This works find, but now there are some items that aren't words, some have spaces and commas in them. How can I return the data between the parentheses regardless of what text is between them? |
Code:
/$data\(([^)]+)\)/ |
Quote:
Code:
/\((.*?)\)/ |
Quote:
Code:
/$data\(([^)]+)\)/ I use the same pattern myself for parsing text with opposing tokens like parentheses, curly braces, and brackets. --- rod. |
Quote:
|
Quote:
Markus |
All times are GMT -5. The time now is 02:13 AM. |