September 6th, 2013, 04:13 AM
Need a Regular Expression pattern in Java
Thanks in advance for your help. I have to replace a string if it's not available inside any single quote.
name = 'abc12namexyz234' or name='def234namewsr345name' and name like '%ab123name345rt%'
In the above I've to replace "name" with "ApplicantEntity.name" but I don't want to replace the string that is available inside the single quote i.e. 'abc12namexyz234'. The result after the replacement should be:
ApplicantEntity.name= 'abc12namexyz234' or ApplicantEntity.name='def234namewsr345name' and ApplicantEntity.name like '%ab123name345rt%'
I am trying to find a appropriate regex. But still no success on that. Please Help....
September 6th, 2013, 12:22 PM
The typical solution is "name" and an assertion that there are an even number of quotes after it. Works so long as you don't break strings over multiple lines.