SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Mar 2007
    Posts
    191
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Regular Expression

    If anyone would be so kind, is it possible to create a regular expression to replace

    Code:
    [button href="*1" title="*2"]*3[/button]
    with

    HTML Code:
    <a href="*1" title="*2">*3</a>
    where the *#s carry over?

    Thanks.

  2. #2
    SitePoint Zealot
    Join Date
    Mar 2007
    Posts
    191
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    wilbat from #regex helped me out.

    This was the solution:
    str.replace(/\[button href="([^"]+)" title="([^"]+)"\]([^[]+)\[\/button\]/, '<a href="$1" title="$2">$3</a>');


Bookmarks

Posting Permissions

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