Stripping characters...

Discussion in 'ASP .Net' started by VJ, Jan 17, 2006.

  1. VJ

    VJ Guest

    I'm trying to strip the characters from a text box...
    but I only know how to apply it to text...
    for example..


    string fname = @"*\John Doe";
    string pattern = @"^.*\\";
    string name = Regex.Replace(fname, pattern," ");


    but how can i do it for a passed variable...
    like @Request.Form["fname"];

    string fname = @Request.Form["fname"];
    string pattern = @"^.*\\";
    string name = Regex.Replace(fname, pattern," ");

    --
    Sent via .NET Newsgroups
    http://www.dotnetnewsgroups.com
     
    VJ, Jan 17, 2006
    #1
    1. Advertising

  2. Have you tried

    string pattern = @"^.*\\";
    string name = Regex.Replace(Request.Form["fname"], pattern," ");


    --
    Regards

    John Timney
    Microsoft MVP

    "VJ" <> wrote in message
    news:%...
    > I'm trying to strip the characters from a text box...
    > but I only know how to apply it to text...
    > for example..
    >
    >
    > string fname = @"*\John Doe";
    > string pattern = @"^.*\\";
    > string name = Regex.Replace(fname, pattern," ");
    >
    >
    > but how can i do it for a passed variable...
    > like @Request.Form["fname"];
    >
    > string fname = @Request.Form["fname"];
    > string pattern = @"^.*\\";
    > string name = Regex.Replace(fname, pattern," ");
    >
    > --
    > Sent via .NET Newsgroups
    > http://www.dotnetnewsgroups.com
     
    John Timney \( MVP \), Jan 17, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?THU=?=
    Replies:
    4
    Views:
    1,473
    Joerg Jooss
    Sep 2, 2005
  2. et
    Replies:
    3
    Views:
    738
  3. Replies:
    1
    Views:
    442
    Hans Kesting
    Jun 1, 2006
  4. Paulers
    Replies:
    7
    Views:
    1,949
    Roedy Green
    Jun 29, 2008
  5. Chris Causer

    Stripping characters off a string

    Chris Causer, Oct 21, 2008, in forum: Ruby
    Replies:
    7
    Views:
    142
    Chris Causer
    Oct 21, 2008
Loading...

Share This Page