Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2024 06:02 AM
I have a catalog client script that validates that input is alphanumeric:
var regex = new RegExp("^[a-zA-Z0-9]*$");
How can I include space in this?
How can I include space in this?
Solved! Go to Solution.
1 ACCEPTED SOLUTION
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2024 06:21 AM
Hi @CatalogCat ,
How about just adding space as below?
var regex = new RegExp("^[ a-zA-Z0-9]*$");
or adding "\s" like this?
var regex = new RegExp("^[a-zA-Z0-9\s]*$");
Is this what you want to do?
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2024 06:21 AM
Hi @CatalogCat ,
How about just adding space as below?
var regex = new RegExp("^[ a-zA-Z0-9]*$");
or adding "\s" like this?
var regex = new RegExp("^[a-zA-Z0-9\s]*$");
Is this what you want to do?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2024 07:00 AM
Thanks, @aizawaken , the first one worked fine.