Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Highlight RegExp matches using javascript

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #241457
    system27
    Participant

    I’m trying to achieve an effect similar to that seen here: http://regexr.com/

    I wish for the user to enter a regular expression in a text box and highlight all matches in a block of text in real-time.

    I have not managed to achieve this and do not understand why the following code will not highlight the selected text.

    Please find the code at the address below:

    http://codepen.io/anon/pen/YqgGRE

    I am very new to JavaScript so welcome any advice!

    #241476
    Shikkediel
    Participant

    Here’s a little something…

    Demo

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.