Regular Expressions....HELP!

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Stephajn Craig

    #1

    Regular Expressions....HELP!

    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\)

    #2
    Re: Regular Expressions.... HELP!

    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" <s.craig@NOSPAM funsunvacations .com> wrote in message
    news:e%23LNZA8S DHA.3088@TK2MSF TNGP10.phx.gbl. ..[color=blue]
    > I'm thinking that I need to use a regular expression to make this work,[/color]
    but[color=blue]
    > 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[/color]
    also[color=blue]
    > 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[/color]
    is[color=blue]
    > also part of another word in the document like say, an image filename[/color]
    called[color=blue]
    > 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
    >
    >[/color]


    Comment

    Working...