regex - Regular expression to verify that string contains { } -


I need to write a regular expression to verify that {} but not {or} in a string. Any light can shine any light

Valid: {abc}, as09 {02} dd, {/ p>

for example, Sdf), sdjafkl} sdjk, sfdsjakl, 00 {00 } 00, aaaaa {d}

invalid: {sdsf, sdfadf}, sdf {Sdfs, 333} 333

***** **** UPDATE **** ******************************************************************************************************** }) [A-zA-Z0-9_- ?. ] $ is $ for your requirement, thanks for all your help :)

  /.** {. * \}. * /  

This ensures that the string has a curved curly bracket that is preceded by a closed curl bracket, string Anywhere in However, it will not be able to ensure that there is only one opening and closing curling bracket - to do this, . * The pattern has to be changed in something more restrictive.

If you want to use these regexes and test, then.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

php - Multiple Select with Explode: only returns the word "Array" -