I'm looking for a regex that will parse a line at a time from a csv file. basically, what string.readline() does, but it will allow line breaks if they are within double quotes.
or is there an easier way to do this?
I am looking for a regex to validate a string. I want to allow numbers, alpha characters, spaces and any of the following characters in any order:
+ - ( ) ,
Thanks.
Hello,
Suppose I have this:
$('ul.child').slideUp('slow');
What would be the regex to find 'ul.child' and 'slow' (including quotes) in the above expression.
I need to do a 2 rule "replace" -- my rules are, replace all open parens, "(" with a hyphen "-" and strip out all closing parens ")".
So for example this:
"foobar(baz2)" would become
"foobar-baz2"
I currently do it like this -- but, my hunch regex would be cleaner.
myString.Replace("(", "-").Replace(")", "");
I'm debugging some code and wondered if there is any practical difference between $1 and \1 in Perl regex substitutions
For example:
my $package_name = "Some::Package::ButNotThis";
$package_name =~ s{^(\w+::\w+)}{$1};
print $package_name; # Some::Package
This following line seems functionally equivalent:
$package_name =~ s{^(\w+::w+)}{\1};
Are there subtle differences between these two statements? Do they behave differently in different versions of Perl?
hi
how to remove only one char (") if there two("") from the string in C# (Regex )
ex.:
123"43""343"54"" ==> 123"43"343"54"
"abc""def"gh""i ==> "abc"def"gh"i
thank's in advance
i want to how to get separate text from group of contents in java..
example
String a = "area href=\"hai.com\" jkjfkjs </area> ndkjfkjsdfj dfjkdsjfl jkdf dljflsd fljdf kd;fsd a href=\"hoo.com\" sdf</a> jisdjfi jdojfis joij";
i would like to get href link only..
how to write regex..
thanks and advance
What is a regex I can write in bash for parsing a line and extracting text that can be found between two | (so that would be ex: 1: |hey| 2: |boy|) and keeping those words in some sort of array?
Given a file path such as: \\server\folder_A\folder_B\etc\more.mov
I need a regex that'll give me the last backslash so I can extract the actual file name.
My attempt of "$\\" is not returning anything.
I'm using coldfusion.
Suggestions...?
i want to check if string doesnt have more than 5 numbers, i can do it this way
Matcher matcher = Pattern.compile("\\d").matcher(val);
i = 0;
while (matcher.find()) {
i++;
}
However i would like to do it without while(because we are using regex validation framework).
I want to be able to match strings like
A2sad..3f,3,sdasad2..2
8, 10, 12, 981 (few area codes in Sweden). Total phone number can be 10 or 11 (digits only)
If 8 + 9 or 10 digits
if 981 + 7 or 8 digits
Can this be done in regex?
something like that ..hm
(8|10|12)\d{n} = Total Length 10 or 11
So why is this not working? I'm creating a regex that will match a formula (which is then part of a larger standard description). But I'm stuck here, as it doesn't appear to want to match embedded formulas within a formula.
stat = /(Stat3|Stat2|Stat1)/
number_sym = /[0-9]*/
formula_sym = /((target's )?#{stat}|#{number_sym}|N#{number_sym})\%?/
math_sym = /(\+|\-|\*|\/|\%)/
formula = /^\((#{formula}|#{formula_sym}) (#{math_sym} (#{formula}|#{formula_sym}))?\)$/
p "(target's Stat2 * N1%)".match(formula).to_s #matches
p "((target's Stat2 * N1%) + 3)".match(formula).to_s #no match
p "(Stat1 + ((target's Stat2 * N1%) + 3))".match(formula).to_s #no match
Hi,
I want to match against Strings such as AhKs & AdKs (i.e. two cards Ah = Ace of Hearts). I want to match two off-suit cards with a regex, what I currently have is "^[AKQJT2-9][hscd]{2}$", but this could match hands such as AhKh (suited) and AhAh. Is there a way to possibly use backreferences to say the second [hscd] cannot be the same as the firs (similarly for [AKQJT2-9])
In regards to this: http://stackoverflow.uservoice.com/pages/general/suggestions/103227-parser-does-not-match-all-valid-urls is this regex adequate or will it need to be refined, if it needs to be refined how so?
\b(?P<link>(?:.*?://)[\w\-\_\.\@\:\/\?\#\=]*)\b
Hi All,
I have the following strings in my application.
/admin/stylesheets/11
/admin/javascripts/11
/contactus
what I want to do is to write a regular expression to capture anything other than string starting with 'admin'
basically my regex should capture only
/contactus
by excluding both
/admin/stylesheets/11
/admin/javascripts/11
to capture all i wrote
/.+/
and i wrote /(admin).+/ which captures everything starts with 'admin'. how can i do the reverse. I mean get everything not starting with 'admin'
thanks in advance
cheers
sameera
I have javascript string variable with
var sttr="We prefer questions that can be answered --------------------- not just discussed ---------------------
Provide details ---------------------------- Write clearly and simply --------------------------answer all the question"
please suggest how to split the string into array of sentences on the basis of dashes(-----) using regex
result should be
array[0]=We prefer questions that can be answered
array[1]=not just discussed
array[2]=Provide details
array[3]=rite clearly and simply
array[4]=answer all the question
Note: dash(-----) range after each sentence is between 10 to 50
hi all,
is it possible to define a regex pattern which checks eg. for 3 terms independent to their position in the main string?
eg. my string is something like "click here to unsubscribe: http://www.url.com"
the pattern should also work with "http:// unsubscribe click"
thx
I know a little bit of regex, but not mutch. What is the best way to get just the number out of the following html. (I want to have 32 returned). the values of width,row span, and size are all different in this horrible html page. Any help?
<td width=14 rowspan=2 align=right><font size=2 face="helvetica">32</font></td>
HI,
I would like to create a function that beautify my text. For this I use a regex who remplace some characters, but it not run. Can you give me the regular expression for this :
Replace the first letter by a caps
Replace any underscore _ by a space
So for example: the_pack_2 will be The pack 2.
Thx
i have $date variable 2009-04-29 which is Y-m-d
anybody can give idea how to extract into $d, $m, $y using simplest method as possible?
regex is preferable.
any more suggestion with simple method will be chosen. :)
For example, for this string,
div.img-wrapper img[title="Hello world"]
I want to match the first space but not the second space (which is enclosed in []). What is the regex?
Anyone have a good regex for Age verification?
I have a date field where I am validating that what the user enters is a date.
basically I wanted to figure out if that date is valid, and then further refine the date to be within x number of years
Perhaps this may be too complicated to tack onto whatever I have too far, but I figured it wouldn't be.
^([1][012]|[0]?[1-9])[/-]([3][01]|[12]\d|[0]?[1-9])[/-](\d{4}|\d{2})$
Provided a url, within a string of text (tweet) such as
"Check out my twitpic http://twitpic.com/1876544594 its awesome"
I need a Rails regex that will return 18744594, the id of this particular twitpic...
This question has been asked here but was for PHP, and I need it for Rails.
I would also be able to pull the name of the site, so the text between http:// and .com "twitpic"
My url looks like:
www.example.com/a-292-some-text-here // 292
www.example.com/a-2-asdfss // 2
www.example.com/a-44-333 // 44
I need a regex to get the 292 from the url.
The ID will always be an integer.
i am using C#.
I want match all phone numbers that are wrapped between << and tags.
This regex for phone numbers:
0[2349]{1}\-[1-9]{1}[0-9]{6}
I tired to add lookahead (and lookbehind) like (?=(?:>>)) but this didn't work for me.
DEMO