|
|
Browse by Tags
All Tags » php » preg_replace
-
I have this kind of strings:
{test1|test2|test3}
This is easy to match with something like:
~{(.*?)}~
But I would like to be able to match strings like:
{test1|test2|test3{subtest1|subtest2}}
or
{test1|test2|test3{subtest1|subtest2{subsubtest1|subsubtest2|subsubtest3}}}
I can't figure out how I could match that in the ...
-
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 ...
-
what i'm trying to do is remove all line breaks in and around certain html (or xml if you will) elements (h[0-9], ul, li) from a string
the following works fine for removing leading and trailing line breaks, but not the ones inside the element:
$text = ...
-
I am working on making a bbcode system with php using preg_replace(), and I am making it so that other tags will not work inside of a code block. This is the code I am currently using, it almost works:
/(?!\[code\])(.*)(\[b\])(.+)(\[\/b\])(.*)(?<!\[\/code\])/Usi
what I want it to do is if [*code] and [*/code] are around the text inside, ...
-
I'm trying to find words in HTML that are between tags using PHP (v5.2.6) preg_replace.
The following rules apply to the matches
full word match only (can also be matched when adjacent to non-word characters such as commas, parenthesis, periods, question marks, exclamation marks, percentage, dollar signs)
e.g. "test" would ...
-
I need the following string: [Link Name|Link Description] (this is standard mediawiki text for links)
to become this: "Link Description"[Link Name] (this is a proprietary wiki format)
Link Description and Link Name are arbitrary values...it will always be bracket, text, pipe, text, bracket
I'm using php and I've attempted to ...
-
Hi,
Anybody knows how to replace the second or third instance of word in a text using regular expression in php (preg_replace())
For example, I have an article about car and let's say the word car occurs 10 times. Now I want to replace the 3rd and 7th instance
of car with some other word. How can I do this with php regular ...
-
Hi, I asking for help in my PHP code optimization. I try to rewrite my old/slow BBCode conversion function to use regex. The allowed BBCodes are
[ b]text[ /b]
[ i]text[ /i]
[ url]domain.com[ /url] or [ url]domain.com|domainname[ /url]
[ img]filename.ext[ /img] or [ img]filename.ext|description[ /img]
It is possible to construct ...
|
|
|