I'm trying to write some c++ code that tests if a string is in a particular format. In this program there is a height followed by some decimal numbers:
for example
"height 123.45" or "height 12" would return true but
"SomeOtherString 123.45" would return false.
My first attempt at this was to write the following:
string action;
cin >> ...
I have a phone number I want to match against a regular expression.
The format of the phone number must match this:
(123) 123-4567 x12345
The extension is optional. Also the extension must contain 1-5 numbers.
Below is a regular expression I wrote that works.
^\(\d{3}\) \d{3}-\d{4}( x\d\d?\d?\d?\d?)?$
I was wondering if there is a b...
I have a simple xml file and I want to remove everything before the first <item> tag.
<sometag>
<something>
.....
</something>
<item>item1
</item>
....
</sometag>
The following java code is not working:
String cleanxml = rawxml.replace("^[\\s\\S]+<item>", "");
What is the correct way to do this? And how do I address t...
Hi ,
I need a regexp help, because for me it will take a lot of time , for you some minutes:)
I have youtube a URL :
http://www.youtube.com/watch?v=9_Hd8hXhg7o&feature=youtube_gdata
I can't add this in embed object , for embed I have to change in this URL :
http://www.youtube.com/v/9_Hd8hXhg7o&hl=en_US&fs=1&
It...
I was performing a code review for a colleague and he had a regular expression that looked like this:
if ($value =~ /^\d\d\d\d$/) {
#do stuff
}
I told him he should change it to:
if ($value =~ /^\d{4}$/) {
#do stuff
}
To which he replied that he preferred the first for readability (I find the second more readable, but that'...
Hi there,
I am looking for a regex pattern to find all the content b/w curly brackets. For example, there is a string.
$string = {xxx yyy zzz}
I want to find a regex pattern so that it can extract the "xxx yyy zzz" out but no {}.
Thank you very much for your help.
...
I'm trying to run a unix regEXP on every log file in a 1.12 GB directory, then replace the matched pattern with ''. Test run on a 4 meg file took about 10 minutes, but worked. Obviously something is damaging performance by several orders of magnitude.
UPDATE: I am noticing that searching for ^(155[0-2]).*$ takes ~7 seconds in a 5.6 MB f...
I have a string in PHP and I want it to match the regex [A-Za-Z0-9]. How can I do this?
...
Hi ALL,
I have the following error when I try to compile my code in g+ compiler using eclipse
In function `ZSt19__iterator_categoryIPKSsENSt15iterator_traitsIT_E17iterator_categoryERKS3_':
C:/Program Files (x86)/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/stl_algobase.h:(.text$_ZN5boost11basic_regexIcNS_12reg...
I am using xVal to validate my forms in asp.net MVC 1.0
Not sure why my regular expression isn't validating correctly.
It does NOT validate with an empty value
It does NOT validate with the value of "1", "12", "123", or "1234"
It validates with the value of
"12345"
It validates with the value of "12345 "
It validates with the value of...
I need to get all substrings from string.
For ex:
StringParser.GetSubstrings("[start]aaaaaa[end] wwwww [start]cccccc[end]", "[start]", "[end]");
that returns 2 string "aaaaaa" and "cccccc"
Suppose we have only one level of nesting.
Not sure about regexp, but I think it will be userful.
...
I need to hide phone numbers (and maybe other contact details) in user generated content to protect my users from anonymous web. Input is very random, therefore
I'd be looking to replace anything that looks like a phone number (e.g.: string of 3 or more numbers) with just dots, and also perhaps remove some exotic notations of e-mail add...
Your task, should you choose to accept it, is to write a Perl regular expression that for a given string, will return the first occurence of a character that is not consecutively duplicated. In other words, both preceded AND succeeded by characters different from itself (or start/end of string respectively).
Example:
IN: aabbcdecc
OUT:...
So I have an input string which is a directory addres:
Example: ProgramFiles/Micro/Telephone
And I want to match it against a list of words very strictly:
Example: Tel|Tele|Telephone
I want to match against Telephone and not Tel. Right now my reg looks like this:
my( $output ) = ( $input =~ m/($list)/o );
The regex above will match...
I have a string which may contain cell address, which is look like:
A1, B34, Z728 - only capital letters and
AA3, ABA92, ZABC83 - there may be several letters before Integer number.
The typical source string is look like:
=3+7*A1-B3*AB28
I need to get collection of all cells in the string: A1, B3, AB28
I tried to use Regex.Matches ...
currently, I used PHPExcel to import excel file,
there is a function $cell->getCoordinate();
I would like to ask any solution for split the cell coordinate alphabet and integer?
e.g A1, A2,
I need to know currently which row, and until which column.
I do some research about split, but not luck for it. Any idea?
...
I have a string of words; let's call them bad:
bad = "foo bar baz"
I can keep this string as a whitespace separated string, or as a list:
bad = bad.split(" ");
If I have another string, like so:
str = "This is my first foo string"
What's the fasted way to check if any word from the bad string is within my comparison string, and ...
I'm trying to use regular expressions (preg_match and preg_replace) to do the following:
Find a string like this:
{%title=append me to the title%}
Then extract out the title part and the append me to the title part. Which I can then use to perform a str_replace(), etc.
Given that I'm terrible at regular expressions, my code is faili...
Also is it possible to combine this with removing periods from within the string? The sentence may have spaces which I'd like to keep.
...
Hi all
There are a lot of numbers like 200 20.5 329.2...in a file. Now, I need replace every number A with A*0.8. Is there any simple method to replace original value with another based on original value?
Best Regards,
...