Vec84
8 years agoContributor
Regular Expressions
Hello,
I have a header bar with a caption property that contains words and numbers. I want to extract the a 10 digit number from the caption string.
I've read through the documentation however I still don't understand how to implement this. The examples also don't seem to help my understanding of the syntax.
I've saved the caption property into a variable. Then created a new instance of the RegExp and tried to match method to return the numbers. I've tried loads of variations but can't seem to get it to work.
re = HIUtils.RegExpr ([0-9]);
re.Match (MYCAPTION);
Log.Message (MYCAPTION);
This is the latest I've tried however I've tried RegExp new instance and I'm just not getting the way to set it up.
I have a header bar with a caption property that contains words and numbers. I want to extract the a 10 digit number from the caption string.
I've read through the documentation however I still don't understand how to implement this. The examples also don't seem to help my understanding of the syntax.
I've saved the caption property into a variable. Then created a new instance of the RegExp and tried to match method to return the numbers. I've tried loads of variations but can't seem to get it to work.
re = HIUtils.RegExpr ([0-9]);
re.Match (MYCAPTION);
Log.Message (MYCAPTION);
This is the latest I've tried however I've tried RegExp new instance and I'm just not getting the way to set it up.
MYCAPTION.match(/\d{10}/)[0]
extracts a 10-digit number from the variable MYCAPTION.