Negative look ahead java

Posted by venu on Stack Overflow See other posts from Stack Overflow or by venu
Published on 2010-05-18T18:43:22Z Indexed on 2010/05/18 19:00 UTC
Read the original article Hit count: 180

Filed under:
|

I need an expression to capture a string like this

"A"[A string that is NOT atleast 5 and atmost 6 digits]"B", In other words capture anything that is NOT the following

A[0-9][0-9][0-9][0-9][0-9]B
A[0-9][0-9][0-9][0-9][0-9][0-9]B

I have tried the negative look ahead

regex = "a((?![0-9]{5,6}).)*d" ;

But it fails to capture all scenarios.

Please help venu

© Stack Overflow or respective owner

Related posts about java

Related posts about regex