regex to select text between 2 string? -
regex to select text between 2 string? -
i've next string
month: march 2011 month: jan 2012 month: dec 2011
and i'd write regex select name of month (ie "march") 2011. mean select between string "month: " , year "2011". regex made
^(month:)[a-za-z0-9]+(2011)$
but doesn't seem work. what's wrong??? results should "march" , "december". thanks!
use lookahead:
/[a-z]+(?= 2011)/ig
see here in action: http://regex101.com/r/fe9lr9
here's javascript demo: http://jsfiddle.net/rzjur/
regex
Comments
Post a Comment