Search Results

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

Page 1/1 | 1 

  • Regex Pattern for ignoring a custom escape character

    - by user1517464
    I am trying to find a suitable regex for matching pair of custom characters in an input string. These custom characters are replaced by their corresponding html tags. For e.g. The input string can have underscores in pairs to indicate words in bold. Hence, _Name_ outputs as <b>Name</b> However if there is a genuine underscore in the string, it cannot be replaced by "bold" tags and has to be ignored. The genuine underscore has to be preceded by / (I couldn't find a better character, it could be one more underscore or hyphen or whatever). Any single or paired occurrance of this genuine underscore has to be ignored by regex. So far I could come up with this regex: var pattern = @"(?!/)_(.*?)(?!/)_"; But it fails in below input string: _Tom_Katy/_Richard/_/_Stephan_and many users It outputs as <b>Tom</b>Katy/<b>Richard/_/</b>Stephan_and many users Many Thanks in Advance, Pr

    Read the article

1