Search Results

Search found 1 results on 1 pages for 'ccolon'.

Page 1/1 | 1 

  • preg_replace or regex string translation

    - by ccolon
    I found some partial help but cannot seem to fully accomplish what I need. I need to be able to do the following: I need an regular expression to replace any 1 to 3 character words between two words that are longer than 3 characters with a match any expression: For example: walk to the beach == walk(.*)beach If the 1 to 3 character word is not preceded by a word that's longer than 3 characters then I want to translate that 1 to 3 letter word to ' ?' For example: on the beach == on ?the ?beach The simpler the rule the better (of course, if there's an alternative more complicated version that's more performant then I'll take that as well as I eventually anticipate heavy usage eventually). This will be used in a PHP context most likely with preg_replace. Thus, if you can put it in that context then even better!

    Read the article

1