boost::regex re("^\\s*([_\\w\\.]+)\\s*=\\s*([^\\s]+)$");
if(re.empty()){
std::cout<<"How is this possible?"<<std::endl;
}
That line prints in my release builds! (The debug builds are fine)
Working with MSVC 2008 (vc 9.0)
Compiler options for DEBUG:
/Od /I "C:\Program Files\boost\boost_1_44_0" /I "C:\gtest-1.5.0\include" /I "includ...
To put this in context, consider these 2 functions:
ml_RestrictToChars = function(input,regex) {
var result = '';var c = '';
var rx = new RegExp(regex);
for (var i = 0; i < input.length; i++) {
c = input.charAt(i);
if (rx.test(c)) {
result += c;
}
}
return result;
};
ml_OmitChars =...
I have the following (Java) code:
public class TestBlah {
private static final String PATTERN = ".*\\$\\{[.a-zA-Z0-9]+\\}.*";
public static void main(String[] s) throws IOException {
String st = "foo ${bar}\n";
System.out.println(st.matches(PATTERN));
System.out.println(Pattern.compile(PATTERN).matcher(...
I have a feeling that I might be missing something very basic. Anyways heres the scenario:
I'm using preg_replace to convert ===inputA===inputB=== to <a href="inputB">inputA</a>
This is what I'm using
$new = preg_replace('/===(.*?)===(.*?)===/', '<a href="$2">$1</a>', $old);
Its working fine alright, but I also need to further re...
So I am trying to create a Javascript Regex that captures the filename without the file extension. I have read the other posts here and 'goto this page: http://gunblad3.blogspot.com/2008/05/uri-url-parsing.html' seems to be the default answer. This doesn't seem to do the job for me. So here is how I'm trying to get the regex to work:
...
I have the idea to use a regex pattern as a template and wonder if there is a convenient way to do so in Python (3 or newer).
import re
pattern = re.compile("/something/(?P<id>.*)")
pattern.populate(id=1) # that is what I'm looking for
should result in
/something/1
...
Anyone have a regex in javascript for converting:
someCamelCase into some-file-case
or
SomeCamelCase into some-file-case
??
If so, that would be very helpful.
Thanks.
...
I am parsing a relatively simple text, where each line describes a game unit. I have little knowledge of parsing techniques, so I used the following ad hoc solution:
class Unit:
# rules is an ordered dictionary of tagged regex that is intended to be applied in the given order
# the group named V would correspond to the value (if...
I've been at this for hours -- I think I need sleep... but no matter how I alter the expression javascript will only capture the 1st and 3rd elements:
var number = 09416;
var mat = "([0-9]+/[0-9]+/[0-9]+\\s+[0-9]+:[0-9]+)\\s+([A-Z]+)\\s+[0-9,]+\\s+(.*?"+number+".+)";
// month / day / year hour : min AMPM byte...
This question has two parts.
First, I need to isolate two strings of text inside a span with the class "test01". Here is what the span looks like:
<span class="test01">
<table width="100%" cellspacing="0" cellpadding="0">
<tbody><tr><td>
<div id="ctl00_ctl07_pnTopBar">
<a href="/Member/MyHome.aspx">My Account</a> <a ...
I found this very handy regular expression on regexlib.com, but i'm at a loss as to how to implement it in my app.
(?:(?:(?<Feet>\d+)[ ]*(?:'|ft)){0,1}[ ]*(?<Inches>\d*(?![/\w])){0,1}(?:[ ,\-]){0,1}(?<Fraction>(?<FracNum>\d*)\/(?<FracDem>\d*)){0,1}(?<Decimal>\.\d*){0,1}(?:\x22| in))|(?:(?<Feet>\d+)[ ]*(?:'|ft)[ ]*){1}
I tested it out ...
Hi guys,
I want to replace consecutive symbols just one such as;
this is a dog???
to
this is a dog?
I'm using
str = re.sub("([^\s\w])(\s*\1)+", "\\1",str)
however I notice that this might replace symbols in urls that might happen in my text.
like http://example.com/this--is-a-page.html
Can someone give me some advice h...
I'm trying to figure out the regex for the following:
String</td><td>[number 0-100]%</td><td>[number 0-100]%</td><td>String</td><td>String</td>
Also, some of these td tags may have style attributes at some point.
I tried this:
String<.*>
and that returned
String</td>
but trying
String<.*><.*>
returned nothing. Why is this?
...
I have text in the following format:
section name 1:
this text goes into the
first section
section name 2:
this text
goes into the second section
etc,
Where section names are arbitrary phrases and section contents will contain free text except section name. I need to split this text into object pairs of type (s...
Hi,
Any of you gone through this task? Please tell me a solution.
I have to extract video id alone from youtube url : http://www.youtube.com/watch?v=Ls8ppLu72NQ&feature=popular
From this i need only Ls8ppLu72NQ How can i extract it. I know i can use string replace but is there a way to
extract it easily with regex.
Url can be ...
a + (ab or cd ) + g is my expression. How can I write a regex in Python to match these?
...
Hi,
I am new to regular expressions.Can anyone help me in writing a regular expression on the following description.
The password contains characters from at least three of the following five categories:
English uppercase characters (A - Z)
English lowercase characters (a - z)
Base 10 digits (0 - 9)
Non-alphanumeric (For example: !, $,...
Hi,
In Java RegEx, how to find out the difference between .(dot) the meta character and the normal dot as we using in any sentence. How to handle this kind of situation for other meta characters too like (*,+,/d,...)
...
Hi all,
I intended to provide my view/business layer with the possibility to send HQL queries in strings to my data layer.
However, the data layer needs to analyze and manipulate these queries (in particular, add a criterion in the where clause).
The supported forms of HQL queries are any combination of the following:
from ...
where ...
hey guys,
When i use this expression:
re.sub("([^\s\w])(\s*\1)+","\\1","...")
I checked the regex at gskinner, its supposed to return me '.'
but it doesn't work.
If i use
re.sub(r"([^\s\w])(\s*\1)+","\\1","...")
It returns me the error:
raise error, v # invalid expression
sre_constants.error: nothing to repeat
Can...