www.webdeveloper.com
Results 1 to 3 of 3

Thread: need help w/ regex

  1. #1
    Join Date
    Nov 2005
    Posts
    10

    need help w/ regex

    string 1 = "thi#769s is sa#769mple te#769xt"
    string 2 = "th<b>i</b>s is s<b>a</b>mple t<b>e</b>xt"


    is it possible to turn string 1 into string 2 using regular expression? can anyone help me with this one, please?

    basically, i need to get rid of all #769 and surround a character the located before #769 by html tags.

    thank you in advance!

  2. #2
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,279
    Try:
    Code:
    s|(.)#769|<b>$1</b>|g
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  3. #3
    Join Date
    Nov 2005
    Posts
    10
    this is perfect! thank you so very much!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles