Regular Expressions....HELP!

Discussion in 'ASP .Net' started by Stephajn Craig, Jul 16, 2003.

  1. I'm thinking that I need to use a regular expression to make this work, but
    I'm not expert at them.

    What I'd like to do is be able to search a document for a specific word or
    words and when found, have them highlighted. However, these words may also
    be part of a filename. For example, let's say I'm searching through HTML
    content for the word foo. All instances of foo can be easily found using
    the Replace command and replacing them with foobar. However, suppose foo is
    also part of another word in the document like say, an image filename called
    food.gif. Replacing foo in this case would cause food.gif to become
    foobard.gif.

    So, the replace command does only half of the job. The other half sounds
    like it has to be done in a regular expression. Can anyone help me with
    this or point me in the right direction?

    --
    Stephajn Craig
     
    Stephajn Craig, Jul 16, 2003
    #1
    1. Advertisements

  2. If the word food is the issue, it will have spaces around it, while food.gif
    will not. You can do a search for food, and perhaps "food " and " food" and
    get all of the instances. In a web app, you can alter the words and add
    something that highlights them, like a style (CSS).

    --
    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA
    Author: ADO.NET and XML: ASP.NET on the Edge

    ****************************************************************************
    ****
    Think Outside the Box!
    ****************************************************************************
    ****
    "Stephajn Craig" <> wrote in message
    news:e%...
    > I'm thinking that I need to use a regular expression to make this work,

    but
    > I'm not expert at them.
    >
    > What I'd like to do is be able to search a document for a specific word or
    > words and when found, have them highlighted. However, these words may

    also
    > be part of a filename. For example, let's say I'm searching through HTML
    > content for the word foo. All instances of foo can be easily found using
    > the Replace command and replacing them with foobar. However, suppose foo

    is
    > also part of another word in the document like say, an image filename

    called
    > food.gif. Replacing foo in this case would cause food.gif to become
    > foobard.gif.
    >
    > So, the replace command does only half of the job. The other half sounds
    > like it has to be done in a regular expression. Can anyone help me with
    > this or point me in the right direction?
    >
    > --
    > Stephajn Craig
    >
    >
     
    Cowboy \(Gregory A. Beamer\), Jul 16, 2003
    #2
    1. Advertisements

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. Jay Douglas
    Replies:
    0
    Views:
    801
    Jay Douglas
    Aug 15, 2003
  2. Andreas Klemt

    Regular Expressions help needed

    Andreas Klemt, Aug 17, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    400
    Andreas Klemt
    Aug 17, 2004
  3. Andreas Klemt

    Regular Expressions Guru needed. Please help!

    Andreas Klemt, Aug 18, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    355
    Andreas Klemt
    Aug 18, 2004
  4. Jason Williard

    Regular Expressions Help

    Jason Williard, Oct 13, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    345
    Jason Williard
    Oct 13, 2004
  5. Raghu Raman

    Urgent help needed in Regular expressions

    Raghu Raman, Mar 22, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    924
    Raghu Raman
    Mar 23, 2005
  6. Lee
    Replies:
    2
    Views:
    446
    Tor Iver Wilhelmsen
    Oct 6, 2003
  7. dmbkiwi

    Help with regular expressions

    dmbkiwi, Aug 26, 2003, in forum: Python
    Replies:
    3
    Views:
    484
    John J. Lee
    Aug 27, 2003
  8. Noman Shapiro
    Replies:
    0
    Views:
    445
    Noman Shapiro
    Jul 17, 2013
Loading...