Regular Expressions PHP
For PHP to filter the regular expression of ALT, Alt has three kinds of cases, the requirements can be filtered out
alt= "Xxxxxxxxxxxx"
alt= ' xxxxxxxxxxxx '
Alt=xxxxxxxxxxxx
Requirements can be filtered out of the above three kinds of conditions.
Example:
......
Requirements can be filtered in a variety of situations without filtering other content. Thank you.
Reply to discussion (solution)
$s =<<< txttxt;echo preg_replace ('/alt= ([\ ' "]?). +?\b\1/is ', ', $s);
For PHP to filter the regular expression of ALT, Alt has three kinds of cases, the requirements can be filtered out
alt= "Xxxxxxxxxxxx"
alt= ' xxxxxxxxxxxx '
Alt=xxxxxxxxxxxx
Requirements can be filtered out of the above three kinds of conditions.
Example:
......
Requirements can be filtered in a variety of situations without filtering other content. Thank you.
$str = '
';
echo preg_replace ('/(. *) (alt=[\ "\ ')?. *? [\ ' \ ']?\s+) (. *)/', ' $1$3 ', $str);
$s =<<< txttxt;echo preg_replace ('/alt= ([\ ' "]?). +?\b\1/is ', ', $s);
The method you provide may only be suitable for the example I wrote above, I give a practical content, I know the filter out of a problem.
For PHP to filter the regular expression of ALT, Alt has three kinds of cases, the requirements can be filtered out
alt= "Xxxxxxxxxxxx"
alt= ' xxxxxxxxxxxx '
Alt=xxxxxxxxxxxx
Requirements can be filtered out of the above three kinds of conditions.
Example:
......
Requirements can be filtered in a variety of situations without filtering other content. Thank you.
$str = '
';
echo preg_replace ('/(. *) (alt=[\ "\ ')?. *? [\ ' \ ']?\s+) (. *)/', ' $1$3 ', $str);
The method you provide may only be suitable for the example I wrote above, I give a practical content, I know the filter out of a problem.
I know I have a problem with that, and that \b was a last resort.
However, since you can satisfy the data of your example, it will be okay.
You're not going to let me get a list of things that might happen? What are you going to do about it?
$s =<<< TXT
Txt;echo preg_replace ('/alt= ([\ ' "]?). +?\1 (\s|>)/is ', ' $ ", $s);
For PHP to filter the regular expression of ALT, Alt has three kinds of cases, the requirements can be filtered out
alt= "Xxxxxxxxxxxx"
alt= ' xxxxxxxxxxxx '
Alt=xxxxxxxxxxxx
Requirements can be filtered out of the above three kinds of conditions.
Example:
......
Requirements can be filtered in a variety of situations without filtering other content. Thank you.
$str = '
';
echo preg_replace ('/(. *) (alt=[\ "\ ')?. *? [\ ' \ ']?\s+) (. *)/', ' $1$3 ', $str);
The method you provide may only be suitable for the example I wrote above, I give a practical content, I know the filter out of a problem.
Did you test me on the end?
$str =<<< TXT
TXT;
echo preg_replace ('/(. *?) (alt=["\"]?. *? ["\']?) (\s+|>)/', ' $1$3 ', $str);
Forget to lean on the back of the case without spaces, plus allow in the last no space in the situation can be
Thank you very much for two bit!