Skip to main content
added 16 characters in body
Source Link
cropredy
  • 73.3k
  • 8
  • 128
  • 284

Replacing special characters with underscore in apex or trigger.I am using below things but getting error.

string groupname=(gr.name).replace(/[^A-Z0-9]+/ig, '_'); 

Error: expecting a right parentheses, found '/'

But working in javascript and java but not in apex trigger.

For testing i have used below code snippets String abc = 'SVP, Customer Service & Support group'; string groupname=abc.replace('/[^A-Z0-9]+/ig', '_'); System.debug('value of string :::: '+groupname); But

String abc = 'SVP, Customer Service & Support group'; 
string groupname=abc.replace('/[^A-Z0-9]+/ig', '_'); 
System.debug('value of string :::: '+groupname);

But it returned me below : SVP, Customer Service & Support group but i want to be returned like SVP_Customer_Service___Support_group

Replacing special characters with underscore in apex or trigger.I am using below things but getting error.

string groupname=(gr.name).replace(/[^A-Z0-9]+/ig, '_'); 

Error: expecting a right parentheses, found '/'

But working in javascript and java but not in apex trigger.

For testing i have used below code snippets String abc = 'SVP, Customer Service & Support group'; string groupname=abc.replace('/[^A-Z0-9]+/ig', '_'); System.debug('value of string :::: '+groupname); But it returned me below : SVP, Customer Service & Support group but i want to be returned like SVP_Customer_Service___Support_group

Replacing special characters with underscore in apex or trigger.I am using below things but getting error.

string groupname=(gr.name).replace(/[^A-Z0-9]+/ig, '_'); 

Error: expecting a right parentheses, found '/'

But working in javascript and java but not in apex trigger.

For testing i have used below code snippets

String abc = 'SVP, Customer Service & Support group'; 
string groupname=abc.replace('/[^A-Z0-9]+/ig', '_'); 
System.debug('value of string :::: '+groupname);

But it returned me below : SVP, Customer Service & Support group but i want to be returned like SVP_Customer_Service___Support_group

added 344 characters in body
Source Link
Jack vardy
  • 918
  • 2
  • 23
  • 43

Replacing special characters with underscore in apex or trigger.I am using below things but getting error.

string groupname=(gr.name).replace(/[^A-Z0-9]+/ig, '_'); 

Error: expecting a right parentheses, found '/'

But working in javascript and java but not in apex trigger.

For testing i have used below code snippets String abc = 'SVP, Customer Service & Support group'; string groupname=abc.replace('/[^A-Z0-9]+/ig', '_'); System.debug('value of string :::: '+groupname); But it returned me below : SVP, Customer Service & Support group but i want to be returned like SVP_Customer_Service___Support_group

Replacing special characters with underscore in apex or trigger.I am using below things but getting error.

string groupname=(gr.name).replace(/[^A-Z0-9]+/ig, '_'); 

Error: expecting a right parentheses, found '/'

But working in javascript and java but not in apex trigger.

Replacing special characters with underscore in apex or trigger.I am using below things but getting error.

string groupname=(gr.name).replace(/[^A-Z0-9]+/ig, '_'); 

Error: expecting a right parentheses, found '/'

But working in javascript and java but not in apex trigger.

For testing i have used below code snippets String abc = 'SVP, Customer Service & Support group'; string groupname=abc.replace('/[^A-Z0-9]+/ig', '_'); System.debug('value of string :::: '+groupname); But it returned me below : SVP, Customer Service & Support group but i want to be returned like SVP_Customer_Service___Support_group

added 7 characters in body; edited title
Source Link
cropredy
  • 73.3k
  • 8
  • 128
  • 284

Replacing special characters with underscore doesn't work in apex or trigger.I am using below things but getting error Works in Javascript

Replacing special characters with underscore in apex or trigger.I am using below things but getting error. string groupname=(gr.name).replace(/[^A-Z0-9]+/ig, '_');

string groupname=(gr.name).replace(/[^A-Z0-9]+/ig, '_'); 

Error:expecting expecting a right parentheses, found '/'

But working in javascript and java but not in apex trigger.

Replacing special characters with underscore in apex or trigger.I am using below things but getting error

Replacing special characters with underscore in apex or trigger.I am using below things but getting error. string groupname=(gr.name).replace(/[^A-Z0-9]+/ig, '_');

Error:expecting a right parentheses, found '/'

But working in javascript and java but not in apex trigger.

Replacing special characters with underscore doesn't work in apex. Works in Javascript

Replacing special characters with underscore in apex or trigger.I am using below things but getting error.

string groupname=(gr.name).replace(/[^A-Z0-9]+/ig, '_'); 

Error: expecting a right parentheses, found '/'

But working in javascript and java but not in apex trigger.

Source Link
Jack vardy
  • 918
  • 2
  • 23
  • 43
Loading