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

Re: Regex to search and replace text

  •  03-13-2007, 9:10 AM

    Re: Regex to search and replace text

    Please read the forum post guidelines before posting next time. There is very little information given here. I will assume a few things here. Firts that you only want to blank out that line and not the rest of the file. With this sample data

    1 omfg woot oh yeah
    2 w00t yeah
    3 omfg blah blah
    4 w00t yeah
    5 w00t yeah
    6 w00t yeah
    7 omfg gone gone gone
    8 w00t yeah
    9 omfg weeeeeeee!!!!

    I will use this regex

    (?<=omfg).*

    It will match all the text that comes after "omfg". So if you replace that with an empty string. 

    1 omfg
    2 w00t yeah
    3 omfg
    4 w00t yeah
    5 w00t yeah
    6 w00t yeah
    7 omfg
    8 w00t yeah
    9 omfg

     I hope that helps, and please read the posting guidelines next time.

    Brendan
     

    Filed under:
View Complete Thread