简体   繁体   中英

How to match the following regex php

I want to write a regex to match only the first and last strings below. So far, I got this regex

%[\w]+@\{[\w"]+\}%

but it wont match anything:

%adasda@{"asdas":"asdas"}% // should match
5% ashdgasjhdgas % //no match
5%ahsdjhasj % // no match
%asdasdas% //should match

希望对您有所帮助:

^%\w+(@[\{"\w\}:]+)*%$

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM