regex - Replace all instances of a pattern with regular expressions in Javascript / jQuery -
Firstly, I do not know much about ragex and need to buy a book because it has proved to me that pick up.
Finally I want to take a dom element, and I would like to change the text directly into "[" and "]" within the brackets and insert a link around the text, and there are several brackets set in the string .
Function ChangeTip () {var link = '& lt; A href = "'$ (' # txtURL '). Attr (' value ') +'" target = "_ blank" & gt; '; $ ('. Tipofthewectip') Replace ('[', link] .replace (']', '
Excluding this task:
- does not work on the second set of bracket
- If a closing is not straight bracket, open directly Deletes all the text before the bracket
I have seen the examples and because the brackets are used in the regedx code, I can not understand how to see and change the bracket For.
Has anyone done something that he can share? Thanks in advance.
Find the text between [and] and replace it with the value of the link, the text itself and the ' 'This means that the matching square brackets are sure' ji 'means' do it many times (do globally)'.
Comments
Post a Comment