Skip to content

Commit f47ea54

Browse files
authored
Create script.js
1 parent 7b4a419 commit f47ea54

File tree

1 file changed

+15
-0
lines changed
  • Specialized Areas/Regular Expressions/Hastag Extraction

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
(function() {
2+
3+
var demoData = "Quick test for hashtag and mention extraction in ServiceNow. " +
4+
"Let's make sure it catches #Hack4Good #ServiceNow #regex and mentions like @ivan and @servicenow.";
5+
6+
var tagRegex = /[#@][A-Za-z0-9_]+/g;
7+
var matches = demoData.match(tagRegex);
8+
9+
if (matches && matches.length > 0) {
10+
gs.info('Found ' + matches.length + ' tags: ' + matches.join(', '));
11+
} else {
12+
gs.info('No hashtags or mentions found.');
13+
}
14+
15+
})();

0 commit comments

Comments
 (0)