Sunday, 15 April 2012

javascript regex pattern for _water_glass -


I need a JavaScript rijks pattern to test a schema variable so that it has none of the following.

  1. It can start with any letter after "_water_glass" and nothing like "xxxx_water_glass" should be after the water_glass

or

  1. This can be just "water_glass", before the throat of the character the character is not necessary and after the glass of water there should be nothing.

Can anyone help on this please regex pattern

It is simply /^.*_?\_water_glass/

  var re = /^.*_?_water_glass/mg; Var str = 'horse.mp3_country_code \ n4343434_country_code \ n_country_code'; Var M; While ((m = re.exec (str)) = = null {if (m.index === re.lastIndex) {re.lastIndex ++; } See your results using // m-variable // example m [0] etc.}}  

demo


No comments:

Post a Comment