I have a string as below:
“http:172.1.” = (10, 1,3);
“http:192.168.” = (15, 2,6);
“http:192.168.1.100” = (1, 2,8);
The string inside ” ” is a Tag and inside () is the value for preceding tag.
What is the regular expression that will return me:
Tag: http:172.1.
Value: 10, 1,3
This regex
returns the text between quotes “” as group 1, and the text in parentheses () as group 2.
NB: when saving this as a string, you will have to escape the quote characters and double the slashes. It becomes unreadable very quickly – like this:
EDIT: As requested, here’s an example use:
For more details, see the Sun Tutorial – Regular Expressions.