Given the following string: ‘s0\\8\\26\\29\\30\\32’ or ‘s0\\8\\26\\’ or ‘s0\\5’, I need to return the last digits of the string.
Given:
function getFolderID(mystr) {
var reFolderID = /\bs0\\\\[0-9]+\b/g //regexp to return s0\\34
var retArr = [];
var retval = '';
retArr = mystr.match(reFolderID);
retArr = retArr[0].replace(/s0\\\\/g, "");
if (retArr != null) {
retval = retArr[retArr.length - 1];
}
//alert("Ret: " + retval);
return retval;
}
At first I thought I just needed the first digits, but turns out I need the last ones.
What would the proper regexp term be for this?
Also, how can I create an ASP.Net event handler to do something with the returned JS value?
You might try the following. It should following the formatting and group the last set of numbers.
So, something like:
As for the ASP.NET event, you’ll probably have to use Ajax — such as by
<asp:UpdatePanel />or your choice of Ajax library (jQuery, Prototype, etc.).Without Ajax, JavaScript and ASP.NET will never execute at the same time.