Click here to Skip to main content
15,937,602 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
how can I find the position of the string "ten" within a sentence, without using the exact string directly . Print as many spaces as there were characters in the original sentence before the aforementioned string appeared, and then the string itself in lowercase.

Example output:
TEN... NINE... EIGHT... TWO... ONE...

What I have tried:

var regex = /ten/gi;
words = words.replace(regex, '');
Updated 8-Jan-22 22:35pm

1 solution

Try like this: /[ -z]*(TEN)/gi
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900