Microsoft
Software
Hardware
Network
Question : get value in string - Jquery based & Regular Expression
Hello, I'm being really braind dead here today.. I need to grad a value out of a file.
It looks like this
Version 1.6.7 - Teremba Bay
--------------------------
---
- #3999 Upload a file with apostrophe make problem
- #4137 small text typo in admin/login.php
Version 1.6.6 - Bonde
--------------------------
---
- #3777 Documentation Error: redirect_url plugin
- #3923 Adminlog download, tab separator single quoted
...
and on and on
all I want to do is get the top, the first Version in this case '1.6.7'
I'm strating off with this...
var jQ = jQuery.noConflict();
jQ.get('doc/CHANGELOG.txt'
, function(data) {
var re = new RegExp(/(?:Version)\s+(.*?
)\-(.*?)/)
;
var m = re.exec(data);
if (m == null) {
alert("No match");
} else {
alert(m[0]);
}
so alert(m[0]); should have in this case alerted '1.6.7'
Thank you.. cheers..
Answer : get value in string - Jquery based & Regular Expression
The matched value is in the index: 1
See below:
1: 2: 3: 4: 5:
if (m == null) { alert("No match"); } else { alert(m[1]); }
Random Solutions
jquery validator and asp.net updatepanel
Predicted harddrive failure
Can someone give me an explaination of a Vector
ClearOS Enterprise 5.2 Alpha 1
How do you use an underscore character in an AutoCad LISP script?
difference between AD integrated dns server and dns server
Respose time slow
Outlook 2007 w/ Exchange 2010 empty folder
get name of the opened file
Reducing bandwidth consumption between domain controllors at multiple sites