#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    1
    Rep Power
    0

    Problem with Regex


    Hi,
    i have a problem with regex...I hope to resolve...
    this is string input :

    text1 text2

    string output:

    text1 text2 without

    i tried to do with .net c#:
    newstring = Regex.Match(oldstring, "[^]+", RegexOptions.IgnoreCase).ToString();

    but my input is only text1 why???? i want also text2 ...
    I want know what i wrong e how i can to resolve
    thank you all
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Location
    /dev/null
    Posts
    162
    Rep Power
    18
    I don't know .NET C# but I hope there's some string function that can replace text.

    Something like,
    Code:
    string.replace("this", "that")
    so that you can say
    Code:
    oldstring.replace("", "")
    The regex you used "[^]+" would match all the characters from the beginning of string until "", so it would match "text1 ". And hence you're getting the output as "text1 " (text1 and a whitespace)

IMN logo majestic logo threadwatch logo seochat tools logo