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. Advertising

  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. 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. Chris R. Timmons

    Re: Help with regular expressions.

    Chris R. Timmons, Jul 4, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    388
    Chris R. Timmons
    Jul 4, 2003
  2. David Waz...

    Re: Help with regular expressions.

    David Waz..., Jul 4, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    371
    David Waz...
    Jul 4, 2003
  3. Jay Douglas
    Replies:
    0
    Views:
    592
    Jay Douglas
    Aug 15, 2003
  4. Andreas Klemt

    Regular Expressions help needed

    Andreas Klemt, Aug 17, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    300
    Andreas Klemt
    Aug 17, 2004
  5. Noman Shapiro
    Replies:
    0
    Views:
    219
    Noman Shapiro
    Jul 17, 2013
Loading...

Share This Page