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

Browse by Tags

All Tags » php pregex
  • replace a word that is not inside a tag

    Hi, I'm using PHP preg_replace function. I need to replace a word inside a text string, that DO NOT match these patterns : <.*".* word.*".*> <h[1-6].*>.*word.*</h[1-6].*> The goal is to replace all occurences of a word inside the html code, on the condition that it's not part of a title ...
    Posted to Construction Advice (Forum) by alex007 on February 11, 2009
  • [PHP] Regex to paste templates

    Hello RegexAdvice users. I am at this time trying to update my template system, and i have desidet to use regex insted of ALOT of explodes :D I this i will start out with showing you what my templates look like. code:<html> <head> <title>Some test</title> </head> <body>    <php:if ...
    Posted to Construction Advice (Forum) by doomstone on November 6, 2008
  • BBCode conversion

    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 ...
    Posted to Construction Advice (Forum) by pandor on August 23, 2008
  • Uncommon URL pattern retrieval

    Hi, Anybody out there, I'd be immensly greatful if you helped me fix one regular expressions of mine. Basically I've written a regular expression in PHP identifying a pattern of a certain type of URL REGEX: /(http\:\/\/dx\.doi\.org\/.*?)(\s|$|;|>)/ it will catch strings of URLs from the 'http://dx.doi.org/' domain, looking ...
    Posted to Construction Advice (Forum) by ksyandagger on August 19, 2008
  • Re: Regex for unknown number of lines - Assistance Request

    It's OK, I think I've found the answer to my own question. The # signs bracket the actual regular expression, and the e and the s are modifiers - e is equivalent to PREG_REPLACE_EVAL and  s is equivalent to PCRE_DOTALL. Maybe these are things which are so familiar to the experienced players that they almost go without saying, but ...
    Posted to Construction Advice (Forum) by mtgradwell on June 8, 2008
  • Re: Regex for unknown number of lines - Assistance Request

    I have a problem which seems similar to the one documented here, so I hope somebody reading this can help me too. I have a page of PHP code which works some of the time, but not always, so I'm trying to discover the bugs in it. It includes the line  preg_match_all('#<!-- start content -->(.*?)<!-- end content -->#es', ...
    Posted to Construction Advice (Forum) by mtgradwell on June 7, 2008
  • Retreiving url from a tag using preg_match_all

    Hi, I have a problem I can't seem to get past so its time to ask for help, I'm trying to extract url's from a link that looks like this: <a href="http://www.somedomain.com/linktopage">[1]</a> my guess was to use something like this, but I'm probably way off, but I used it because it was very important to me ...
    Posted to Construction Advice (Forum) by Dade72 on May 9, 2008