- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2020 07:20 AM
Hi all,
I have a Validation regex for a field within a catalogue item.
It currently does not allow the characters [^"();:<>]+ which works fine.
But now I need to prevent spaces being entered at the beginning, middle or end, how can I do this?
Can I add some characters to the current regular expressions field?
I
Thanks in advance,
Usmaan.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2020 06:19 AM
Hi,
Above provided solution is also from Orlando.
To approach ServiceNow,
Create HI ticket.
https://hi.service-now.com/hisp
If it is ok for you can you share the PDI details on dhananjay.pawar1111@gmail.com I will check.
If possible share
Catalog item name and access details.
Thanks,
Dhananjay.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2020 01:40 AM
Try liek this. Instead of + use * at the end.
^[^"();:<>\s]*$
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2020 01:45 AM
Hi Asif,
I tried that but it's not made a difference.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2020 02:08 AM
Hi,
Can you validate what is allowed instead what is not allowed.
Try regex which is allowed in that variable.
E.g /^[a-zA-Z0-9]*$/; // this allowes only characters and numbers.
Can you tell us what should allowed in that variable.
Thanks,
Dhananjay.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2020 02:48 AM
Hi Dhanajay,
only letters, numbers and underscore (_) and hyphen (-) should be allowed.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2020 02:53 AM
try below,
^[a-zA-Z0-9_-]*$
Thanks,
Dhananjay.