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
Copy "Protect Sheet" setttings to all tabs in a workbook
WRT54G - filter out websites
Shadow Copy
Complete uninstall of Sharepoint Services 3.0 from Windows 2008 Server
Turn off Public Folder Replication in Exchange 2007
Why cant I use the native mail client on the new HTC Evo to syn with ActiveSync to our OWA site?
Get the name of an active control
Apple iWeb - how to save HTML to Disk or to publish the web site via FTP?
SAS or SATA
I can't find the audio driver for a Satellite P30