regex pattern to match specific number pattern , skip if there different
pattern
Requirement: If pattern 57XXXXXXX OR 57XXXXXXX-X found in a sentence ,
then copy this matched pattern (X- denotes 7 integer number and 57 are
constant values must be there) , else ignore complete sentence.
I have written a regex pattern 57[0-9]{7}|-[0-9]{1} to do match both the
pattern. if below pattern found(8 digits after 57 instead 7 , then still
above regex still gets the matching pattern (actually am expecting regex
should not match) for e.g. some text 571234567*9*-0 some text --> regex
matches and gives 5712345679-0
Am java to compile above pattern.
any suggestion please ?
No comments:
Post a Comment