Options
			
				
					
	
			
		
	- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
12-04-2023 09:51 PM
Hi All,
Actually i need regular expression that allows currency (numbers ) and as well as decimal values also
Currently i have regular expression that only allows numbers, so i need to decimal values also along with this
please help me to complete this
Thanks
Deepika
Solved! Go to Solution.
		1 ACCEPTED SOLUTION
	
		
			Options
			
				
					
	
			
		
	- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
12-04-2023 10:15 PM
Hi @Deepika61
Can you try below :
var reg = /^AUD\s\$(\d{1,5}(\.\d{1,2})?)$/;
if(reg.test('AUD $100.12')){
gs.print(true);
}
/*
^   : Start
AUD : Currency symbol
\s  : space after currency symbol
\$  : dollar sign
\d{1,5}  : upto 5 digit
(\.\d{1,2})? : optional decimal (two dogit)
*/
test it on background script
	Vishal Birajdar
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
			
			
				
			
			
				
			
			
			
			
			
		ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
		1 REPLY 1
	
		
		
			
			
			
					
	
			Options
			
				
					
	
			
		
	- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
12-04-2023 10:15 PM
Hi @Deepika61
Can you try below :
var reg = /^AUD\s\$(\d{1,5}(\.\d{1,2})?)$/;
if(reg.test('AUD $100.12')){
gs.print(true);
}
/*
^   : Start
AUD : Currency symbol
\s  : space after currency symbol
\$  : dollar sign
\d{1,5}  : upto 5 digit
(\.\d{1,2})? : optional decimal (two dogit)
*/
test it on background script
	Vishal Birajdar
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
			
			
				
			
			
			
			
			
			
		ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
