Hi, I have tried 2 questions, could you tell me whether I am right or not?
Regular expression of nonnegative integer constants in C, where numbers beginning with 0 are octal constants and other numbers are decimal constants.
I tried 0([1-7][0-7]*)?|[1-9][0-9]*, is it right? And what string could I match? Do you think 034567 will match...
I just found the <wbr> element (link) which basically lets specific an area where a break could apply if needed.
Basically I'd like to implement it in my apps, to prevent breaking the layout due a comment in a blog with too many letters or signs.
The problem is: it has to be HTML compatible, so averylongmadeupandunnecesaryunspacedword ...
I'm a regexp newbie and I would like to know how to do a search and replace for the following case:
A file contains many occurrences of the following:
L1234_XL3.ext
and also many occurrences of:
L1234_XL3
I only want to find and replace L1234_XL3 occurrences with XL3 without affecting instances that have an extension.
I am using ...
I am trying to validate a string as a phone number (digits and certain special characters). I used a existing code snippet from here: http://snippets.dzone.com/posts/show/597 which seems to be correct. But everytime string.match(format) returns null, which causes to show the error message.
var format = /^(\+\d)*\s*(\(\d{3}\)\s*)*\d{3}(-...
For PMD I'd like to have a rule which warns me of those ugly variables which start with my. This means I have to accept all variables which do NOT start with my.
So, I need a RegEx (re) which behaves as follows:
re.match('myVar') == false
re.match('manager') == true
re.match('thisIsMyVar') == true
re.match('myOtherVar') == f...
I use Eclipse Galileo to develop Java code. When implementing an interface for mocking, I often want to specify the behavior of just a few methods and retain the default behavior (do nothing or return null/0) for most. Eclipse will produce a nicely formatted default implementation like:
HttpServletRequest mock = new HttpServletReque...
Hi,
I need to make a regular expression to extract some strings.
The searching string could be like:
ANY_STRING(string1)this is
searching string1
ANY_STRING(string2)this is
searching string2
The match strings should be:
(string1)this is searching string1
(string2)this is searching string2
Any idea?
Thanks.
...
I'm trying to do some fairly simple string parsing in bash script.
Basically, I have a file that is comprised of multiple multi-line fields. Each field is surrounded by a known header and footer.
I want to extract each field separately into an array or similar, like this
>FILE=`cat file`
>REGEX="@#@#@#[\s\S]+?@#@#@"
>
>if [[$FILE =~ ...
When looking at the accepted answer of stripping out all characters from a string, leaving numbers, the author added a + after the expression
$str = preg_replace('/[^0-9.]+/', '', $str);
in order to find sub-strings, instead of single occurrences, to remove. For the functionality the + is optional. But I started to wonder whether addi...
Is there a single regular expression that can parse a string (in Python and Javascript, does not need to be the same expression) that represents simple boolean arithmetic? For example I want to parse this string:
a and (b and c) and d or e and (f or g)
Assuming that:
* parentheses do not nest
* the terms a, b, ..., z are not sub-expre...
How can the regex below be modified to match dates with ordinals on the day part? This regex matches "Jan 1, 2003 | February 29, 2004 | November 02, 3202" but I need it to match also: "Jan 1st, 2003 | February 29th, 2004 | November 02nd, 3202 | March 3rd, 2010"
^(?:(((Jan(uary)?|Ma(r(ch)?|y)|Jul(y)?|Aug(ust)?|Oct(ober)?|Dec(ember)?)\ 31...
HI!
I use this the following regex with JS to extract this id 6321890784249785097 from that url
http://video.google.com/googleplayer.swf?docId=6321890784249785097
url.replace(/^[^\$]+.(.{19}).*/,"$1");
But I only cut the last 19 chars from the tail. How can I make to more bullet-proof? Maybe with an explanation so that I learn somet...
Hello Every one.
I want to use regex for the following expression.
here mail id can be any thing. but I just want to cut this string.
I was trying following code.
NSString *email=@"<a href=\"mailto:[email protected]\">";
NSString *strEmailMatchstring= @"\\b([a-zA-Z0-9%_.+\\-]+)@([a-zA-Z0-9.\\-]+?\\.[a-zA-Z]{2,6})\\b";
if(![...
With PHP, how can I isolate the contents of the src attribute from $foo? The end result I'm looking for would give me just "http://example.com/img/image.jpg"
$foo = '<img class="foo bar test" title="test image" src="http://example.com/img/image.jpg" alt="test image" width="100" height="100" />';
...
Hi,
How do I create groups with names in C# using Regular expressions, and is it good practice?
Thanks in advance.
...
Hi,
First, this question may have been asked before, but I'm not sure what phrase to search on.
I have a string:
Maaaa
I have a pattern:
aaa
I would like to match twice, giving me starting indices of 1 and 2. But of course I only get a single match (start index 1), because the regex engine gobbles up all 3 "a"s and can't us...
I had this regex in java that matched either an alphanumeric character or the tilde (~)
^([a-z0-9])+|~$
Now I have to add also the characters - and _ I've tried a few combinations, neither of which work, for example:
^([a-zA-Z0-9_-])+|~$
^([a-zA-Z0-9]|-|_)+|~$
Sample input strings that must match:
woZOQNVddd
00000
ncnW0mL14-
dEow...
I'm not validating emails. What I want to do is find (and then change) 3 separate types of "email" content in a (html) string:
a plain email: eg [email protected]
a mailto href: eg <a href="mailto:[email protected]">[email protected]</a>
an aliased href: eg <a href="mailto:[email protected]">user's email</a>
I'm then going to transform each example ...
Given "http://google.com/path-to-page" trip to "google.com"
What php and regex would be appropriate?
...
I'm using Delphi with the JCLRegEx and want to capture all the result URL's from a google search. I looked at HackingSearch.com and they have an example RegEx that looks right, but I cannot get any results when I try it.
I'm using it similar to:
Var re:JVCLRegEx;
I:Integer;
Begin
re := TJclRegEx.Create;
With re do try
...