- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2017 04:35 PM
Hi,
I need to extract the sys_id from a string:
bla bla bla name="sys_id" value="SYSID"
Example: parameter name="sys_id" value="bd3192d73739b200166ed2e843990e40"
So I have this:
var regexp = /name="sys_id" value="([^{32,}$])/;
var out = (current.u_text.match(regexp))[1];
gs.addInfoMessage('out is ' + out);
The infoMessage shows: out is b
The sys_id is bd3192d73739b200166ed2e843990e40, so I get the first character.
Also tried: var regexp = /name="sys_id" value="([^\w{32,}$])/; and all kind of combinations with [a-z0-9].
Your thoughts are welcome.
Harel
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2017 04:44 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2023 01:44 AM - edited 05-23-2023 01:47 AM
The thing is that this also matches something like "Hello12345678901234567890123456789012World". Typically, you want to make sure that there are word boundaries around the Sys ID and also make sure the case does not matter with the "i" flag:
var regexp = /\b[0-9a-f]{32}\b/i
I use a tool like RegExr: Learn, Build, & Test RegEx to test such Expressions.
Also, I can really recommend this resource: Regular Expressions :: Eloquent JavaScript
If this answer was helpful, I would appreciate if you marked it as such - thanks!
Best
Daniel