Clarification in positive look ahead regex

Hi Team,

I have a doubt and just checking the positive look ahead regex patterns and have a below doubt

In the image below it is matching the expected pattern JJHDR - using javascript regex

i want to retrieve the string INR so i appended -A-Z but it is not matching and included the () but it is not highlighting. Could anyone let me know how to fetch the string INR and when to use the brackets () in identifying a pattern

Thanks,
Ula

I used the below pattern

Hi,

Hope the following expression helps you.

(?<=invoice number-\d+-[A-Z]+-)\w+(?=-)

img20200220-2

PS. Perhaps you should use regex tester for .net because regex engine for .net is not same as JaveScript etc. (However the above expression will work in .net)

Regards,

1 Like

Hi @Yoichi Thank you it perfects highlights INR and i have one more doubt. hope you know that we use ^ and $ symbol for start and end line. If i use that it is not highlighting INR. do i need to change anything in the regex pattern?

Thanks,
ula

hi,

If you want to use ^ and $ symbol in your expression, it will be the following.

(?<=^invoice number-\d+-[A-Z]+-)\w+(?=-.*$)

img20200220-3

Regards,

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.