php - Regex match the double quote in BBCode attribute -
I have some text in my forum database stored in the following:
< Some text "
what I want to do with code [[COLOR =" red "] color text [/ COLOR] and [SIZE =" 7 "] big fonts [/ SIZE] A regex that matches any double quotes with any string ""
, while those double quote marks are within square brackets []
BB code of the square .
I need it Repex implementation is going to use PHP.
You can find something like this:
$ code = '[COLOR = "red"] color text [/ COLOR] and [SIZE = "7"] large font [/ SIZE] is not matched while "This double quote" is not matched; Preg_match_all ('/'[.*?= "(\ w +)" \] /', $ code, $ match, PREG_PATTERN_ORDER); For ($ i = 0; $ i & lt; count ($ matches [1]); $ I ++) {echo $ match [1] [$ i]. "\ N"; }
Demo:
Comments
Post a Comment