Use regex 2

Dear all,
can someone Support

i try to exteact just these values from below text.

value 1 : VAT Registration NumberBE0467850695
Value2 :VAT Registration NumberNL806558519B01

i use this regext((VAT Registration Number[A-Z]{2,}\d+)(?![\s\S]*\1)) which extract me
value 1 :VAT Registration NumberBE0467850695 >>>> Correct
wrong value 2 :VAT Registration NumberNL806558519 >>>not correct

can please some one support me to adjust the regex code to extarct value 1 as its and value with letter B and 2 digital number

Thanks a lot

"nEstablishment Status\r\n\r\n\r\n \r\n\r\n\r\n\r\n\r\n\r\nEstablishment Status Text\r\n\r\n\r\n\r\nEditEdit Establishment Status DeleteDetailsDetails\r\nNo ChangesBE0Tax Number CategoryBE0Belgium: VAT Registration NumberDescriptionBelgium: VAT Registration NumberBE0467850695Tax NumberBE0467850695REstablishment StatusRRegisteredEstablishment Status TextRegistered\r\n\r\nEditEdit Establishment Status DeleteDetailsDetails\r\nNo ChangesNL0Tax Number CategoryNL0Netherlands: VAT Registration NumberDescriptionNetherlands: VAT Registration NumberNL806558519B01Tax NumberNL806558519B01EEstablishment StatusEEstablishedEstablishment Status TextEstablished\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nIndustries\r\nIndustries "

Hello @Abdalla,

Can you try this expression?

((VAT Registration Number)[A-Z]{2}\d{10}|(VAT Registration Number)[A-Z]{2}\d{9}[A-Z]{1}\d{2})

try here!1

cheers

2 Likes

Hi,

How about the following expression?

System.Text.RegularExpressions.Regex.Matches(text,"VAT Registration Number[A-Z]{2}[A-Z0-9]+\d")

Regards,

1 Like

Hello

If you wanted a third option :slight_smile:

Try this pattern:

(?<=VAT Registration Number)[A-Z]{2}[A-Z\d]+(?=Tax)
Preview the results here

Sample workflow:
Main.xaml (6.2 KB)

If you want to learn Regex - check out my Regex MegaPost: Regex help tutorial MEGAPOST – Making your first Regex post, Reusable Regex Patterns, Regex Troubleshooting, Sample Workflow and more

Cheers

Steve

1 Like