Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Need to select 2 letters with RegExp

Tags:

regex

php

The thing is I have a string like this:

iata_code@name@city@gmt_offset@country_id@iso_code@latitude@longitude@air_os@air_lx@air_lh@air_sn@air_nz@air_su@air_s7@air_a3

The marked symbols are need to be selected with regexp. It would be great if someone smart will be so kind to help me :)

I was able to write only:

/(@air_)\w+/g

Thanks in advance!

like image 999
Alexey Avatar asked Jan 01 '26 02:01

Alexey


1 Answers

This lookbehind regex should work:

(?<=air_).{2}

Online Demo

like image 146
anubhava Avatar answered Jan 02 '26 14:01

anubhava



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!