RegEx on server side scripts

dharani2607
Tera Contributor

Hello,

Need to write script in server side to replace / or \ with empty space.

I found below in community:

The SNC.Regex API is not available for scoped applications. For scoped applications, remove the SNC.Regex API and use standard JavaScript regular expressions.

We are using scoped applications, in that case how to achieve this?

 

Thanks

11 REPLIES 11

Hi @dharani2607 

You can try this

var string = 'test \ document / printed \ updated';

var regex = /\//g;

var newText = string.replace(regex, ' ');

gs.log(newText);

//this will print "test  document  printed  updated

 

Mark as correct and helpful if it solved your query.

Regards,

Sumanth

 

@dharani2607 

Feel free to ask if you still have questions or else you can close this thread by marking an answer as correct so it benefits future visitors.

 

Regards,

Sumanth