regex - regx - extracting everything between an underscore and a dot from text -


i trying extract between _ , . in text:

cil20150424_nsgs02rpk.dat cil20150424_nsu01mah.dat 

to give me these matches:

nsgs02rpk nsu01mah 

i using site , best can locate _ using negitive ahead:

\d(_=?) 

but selects 4 4_.

how select between _ , . in text?

this regex matches target:

(?<=_).*?(?=\.) 

see live demo.

the regex uses behind underscore, reluctant quantifier (in case there's more 1 per line), , ahead dot (which must escape match literal dot).


btw attempt @ ahead (_=?) not ahead, it's captured (bracketed) underscore followed optional equals sign.


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -