Click here to Skip to main content
15,503,491 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...
ten


What I have tried:

var regex = /ten/gi;
words = words.replace(regex, '');
Posted
Updated 8-Jan-22 23: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