The regular expression for locating a precise word at the tenth position in JavaScript would be:
/\b\w{9}WORD\b/
where WORD
is the word you want to match.
This regular expression will match any word that is exactly at the tenth position in the string. \b
represents a word boundary, \w{9}
represents any word character occurring exactly 9 times, and the final \b
ensures that the word is not a part of a larger word.
Asked: 2022-06-04 11:00:00 +0000
Seen: 12 times
Last updated: Jan 21 '23