|
|
Browse by Tags
All Tags » php » backreference
-
Hi regex experts,
I’m searching for a regular expression for PHP’s preg_replace() in order to adjust concatenated strings (no multi-line).
These strings are fragments in German which form a sentence and therefore need to be (automatically) edited to adhere to grammar conventions.
Roughly speaking, the regular expression should ...
-
In the following string:
<div class="x" bla bla bla <div class="x" bla bla bla <div class="x" bla bla bla EXAMPLE STRING
I want to match: <div class="x" bla bla bla EXAMPLE STRING
NOT
<div class="x" bla bla bla <div class="x" bla bla bla <div ...
-
Sorry for committing thread necromancy, but I had some time on my hands and this post had no answer .
My idea of a regex for this problem looks like this:
(?is)<meta\s[^>]*\bcontent\s*=\s*(['"])?((?(1)(?!\1).*?|[^\s>]*))(?(1)\1)
In PHP you would do something like:
$pattern = ...
|
|
|