var regside = /(?<=_).+?(?=.png)/gi;but the firebug returns me "invalid quantifier"?
3 replies to this topic
#1
Posted 21 November 2011 - 03:07 PM
I use simple syntacsis:
|
|
|
#2
Posted 21 November 2011 - 06:48 PM
Maybe this will help.
I'm not a pro in regex, and never understood the assertions, but your problem is here: ?<=
If you remove the lookbehind assertion firebug work... but I can't tell you why, or how to solve it... sorry
I'm not a pro in regex, and never understood the assertions, but your problem is here: ?<=
If you remove the lookbehind assertion firebug work... but I can't tell you why, or how to solve it... sorry
#3
Posted 22 November 2011 - 04:12 AM
look, or others, I need to select word "example" from this string: helloworld/something_example.ref, who can tell me how it must be with javascript?
#4
Posted 22 November 2011 - 05:14 AM
regex: .*/.*_(.*)\..{3}
Assuming the extension is always 3 characters.
This regex matches a lot of things, but it's hard to write a good regex with just 1 example
Assuming the extension is always 3 characters.
This regex matches a lot of things, but it's hard to write a good regex with just 1 example
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
function begin(){
var input= 'helloworld/something_example.ref';
var pattern= new RegExp('.*/.*_(.*)\..{3}');
var matcher = pattern.exec(input);
alert(matcher[1]);
}
</script>
</head>
<body onload="javascript:begin()">
</body>
</html>
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









