my problem is that i have a strings of regular expression seperated by '|'
and if i have a regular expression of a sort like
.... ([0-9]{2}-[0-9]{2}-[0-9]{2}(-[0-9]{2})?)|([0-9]{2}(\-[0-9]{2}){2}(\-[0-9]{3,5}){2})|..
and if i have a string like "21-31-51-000-002" jregex finds the match only with the first regular expession and gives the match result as "21-31-51-0" and not the actual result "21-31-51-000-002" that should match with the second regular expression is there any way to do this
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Jregex is a Perl-style regex engine, so there isn't.
That is the cost we pay for rich functionality.
The POSIX regular expressions don't have such things as look-arounds, anchors, unicode support, and may be something else.
The only truly POSIX decent RE engine I know of is the ...awk.* part of the Jakarta-ORO.
Regards
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
my problem is that i have a strings of regular expression seperated by '|'
and if i have a regular expression of a sort like
.... ([0-9]{2}-[0-9]{2}-[0-9]{2}(-[0-9]{2})?)|([0-9]{2}(\-[0-9]{2}){2}(\-[0-9]{3,5}){2})|..
and if i have a string like "21-31-51-000-002" jregex finds the match only with the first regular expession and gives the match result as "21-31-51-0" and not the actual result "21-31-51-000-002" that should match with the second regular expression is there any way to do this
Hello, saktheesh_p!
That is the normal behaviour for Perl-style regex engines.
If the 1-st '|'-separated alternative matches, no others are tried for the longer match.
That are the POSIX-style regexes that search for globally longest match.
Cheers
is there any way that i can make the jregex get the longest match
Jregex is a Perl-style regex engine, so there isn't.
That is the cost we pay for rich functionality.
The POSIX regular expressions don't have such things as look-arounds, anchors, unicode support, and may be something else.
The only truly POSIX decent RE engine I know of is the ...awk.* part of the Jakarta-ORO.
Regards
I've got an idea.
You can use the proceed() method to get all possible matches at a particular place.