My data is
Hello ***** World
I need
Hello **** World
So basically 5 occurrences of star replaced with 4 occurrences of star. How can I do that In regex javascript.
NOTE: The number of star is dynamic.
I tried this but not sure how to replace the capturing group:
console.log("Hello ***** World".replace(/[a-zA-Z](.*)/gm,"$1||$3"));
UPDATE:
Wiktor's solution works like a charm. But not sure how to translate this to my actual problem I am facing in my regex. So I thought, it will be worth to post my actual problem.
My Data is this:
1. Hello
• World
I need this
1. Hello
• World
I need to reduce number of extra lines to n-1 between
[Numeric].[Space][Any text]
and
•[Three Spaces][AnyText]
and vice vera
•[Three Spaces][AnyText]
and
[Numeric].[Space][Any text]
Note: Sorry for poor explanation. I am noob in regex.