Got more questions? Find advice on: ASP | SQL | XML | Windows
in Search
Welcome to RegexAdvice Sign in | Join | Help

Browse by Tags

All Tags » preg_replace
Showing page 1 of 2 (16 total posts)
  • preg_replace of http adresses

    hi im using PHP and i got this function in my forumsoftware:   function links($text, $conf) { $text = preg_replace("/(\s)http:\/\/([\S]+?)(\s)/i" , "$1http://$2$3" , " $text "); $text = ...
    Posted to Construction Advice (Forum) by hayopai on February 17, 2011
  • How to match same pattern existing inside pattern?

    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 ...
    Posted to Construction Advice (Forum) by www on February 13, 2011
  • remove between two characters if a substring is present

    Hi, I am using the regex: $st='@cfcfcf|7a7a7a|777777|6|dedede|858585|fghtytyjtjt@@cfcfcf|7a7a7a|777777|6|dedede|858585|rrrreeee@@cfcfcf|7a7a7a|777777|6|dedede|858585|brown@' $st = preg_replace('!@.*?brown?@!s', '', $st); to strip between @ and @ when 'brown' is found. This may or may not be the last in the ...
    Posted to Construction Advice (Forum) by splendidbob on September 20, 2010
  • Changing patterns depending on structure within substring

    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 ...
    Posted to Construction Advice (Forum) by casualcoder on March 20, 2010
  • replace pattern between anchor tags

    Platform: PCRE Purpose:  am trying to teach myself a little PCRE.  In particular an expression has been nagging me: <?php $text="this-that <a href=\"\">this-that</a> ...
    Posted to Construction Advice (Forum) by james438 on March 9, 2010
  • weird linebreak problem in php preg_replace

    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 = ...
    Posted to Construction Advice (Forum) by blarg on January 12, 2010
  • find if either stringa or stringb do not exist in a string

    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, ...
    Posted to Construction Advice (Forum) by sarathi on July 31, 2009
  • Replace matches in HTML

    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 ...
    Posted to Construction Advice (Forum) by mrboskits on July 16, 2009
  • a challenging regex solution needed...

    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 will always be bracket, text, pipe, text, bracket I'm using php and I've attempted to ...
    Posted to Construction Advice (Forum) by slapshot on June 12, 2009
  • How to replace multiple matched patterns with multiple patterns?

    Hi,  Let me explain the scenerio: I have the input text "Mr. XYZ is a very nice person and have a very good taste of humor" I want to write one replace string and once pattern string such that I can do the following things: er -> gh av -> th these are two papperts that I can match with the pattern string ...
    Posted to Construction Advice (Forum) by princeoo7 on November 10, 2008
1 2 Next >