Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Oct 2006
    Location
    Lisboa, Portugal
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Regex to get text between tags

    hi guys,

    is it possible to extract only the text between the two tags in the following string, with a regex?

    "<td>John Doe</td>"

    thanx for the help

  • #2
    New to the CF scene
    Join Date
    Oct 2006
    Location
    Lisboa, Portugal
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well i found a solution myself. I dont know if its the better, but at least is one.

    var reg = /[^(<td>)].+[^(</td>)]/;

    if anyone has a better solution, please let me know!

  • #3
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,298
    Thanks
    203
    Thanked 2,561 Times in 2,539 Posts
    or var reg= /<td[^>]*>(.*)<\/td>/i;


  •  

    Posting Permissions

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