I've been learning about user scripts and I've been messing around with Joe Simmon's Script when I came across a problem. Say for example that I have a webpage that says 'I want to go to a park.' If I want to replace 'a' with 'the', it would produce 'I wthent to go to the ptherk.' instead of 'I want to go to the park.' Is there any way to change to code so that it would replace the instances of 'a' where it is a word by itself instead of every instance of a in every string. And can you explain what you are doing so that I may learn. Thanks.
Asked
Active
Viewed 101 times
-2
-
Make a specific example with the code in your question and not in a link. Show 1) Before HTML, 2) Desired after HTML. 3) What you have tried. ... Review the [FAQ]. – Brock Adams Dec 19 '15 at 06:44
1 Answers
0
That code has an example: '/\\bD\\b/g' : '[D]'
, the symbol \\b
denotes a word boundary.
You'll need '/\\ba\\b/g' : 'the'
and '/\\bA\\b/g' : 'The'
.

wOxxOm
- 65,848
- 11
- 132
- 136