-1

I wonder if there is a way to make a string uppercase using regex only in JS. The thing is that I am giving my users a string transformation system.

The user supply me with three parameters : original text, replace regex, subtitution regex.

for example:
original : 'stackoverflow'
replace : /([a-z])(.*)/g
subtitution : $1

Result : 's'

I want to give them the abilitty to set the entire string to uppercase. I've noticed in some other SO questions that there are systems that allows that. for example in sublime text you can do '/\U$1/' to set the entire string to uppercase.

Notice: I cannot use toUpperCase or toLowerCase in any way

Matan Kadosh
  • 1,669
  • 3
  • 18
  • 24

1 Answers1

0

Javascript has an inbuilt uppercasing method

var str = "Hello World!";
var res = str.toUpperCase();
The result of res will be:

HELLO WORLD!
Our_Benefactors
  • 3,220
  • 3
  • 21
  • 27
  • I know, but as I mentioned I let my users just supply me with two regexes. They have no access to the 'toUpperCase' method. That is why I asked for regex only solutions – Matan Kadosh Aug 07 '17 at 16:11