How make regex that means "contains regex#1 but NOT regex#2" ??I'm looking over the docs for the re module and can't find how to
"NOT" an entire regex.
For example.....
How make regex that means "contains regex#1 but NOT regex#2" ?
Chris
On 2008-07-01, seberino@spawar.navy.mil <seberino@spawar.navy.mil> wrote:
> I'm looking over the docs for the re module and can't find how to
> "NOT" an entire regex.
(?! R)
> How make regex that means "contains regex#1 but NOT regex#2" ?
(\1|(?!\2))
should do what you want.
Albert
On Jul 1, 2:34=A0am, "A.T.Hofkamp" <h...@se-162....
perl regex to java regexI am trying to convert a piece of code from using perl regexes to
using java regexes.
I need some help with converting the following two PERL syntax regex's
to java syntax regex's. Can anyone please help
1. FIRST_PERL_REGEX = "/^[\\d]*$/"
2. SECOND_PERL_REGEX = "/^[\\d]*/"
(All I am trying to do in the above regex's is try to look for an
integer)
essentially I need the equivalent FIRST_JAVA_REGEX and
SECOND_JAVA_REGEX for the above.
"Rick Venter" <rick_venter@yahoo.com> wrote in message
news:e6f6eb95.0310290901.38be6c02@posting.google.com.....
regex =~ string or string =~ regex?Sometime I saw you wrote regex =~ string, while sometime you wrote
string =~ regex.
What's their difference and what's the recommended way? Thanks.
Jenn.
On 01/04/2010 10:27 AM, Ruby Newbee wrote:
> Sometime I saw you wrote regex =~ string, while sometime you wrote
> string =~ regex.
> What's their difference and what's the recommended way? Thanks.
The first version invokes method Regexp#=~ and the second version
invokes String#=~ - which happen to do roughly the same although I
believe the second one to be a tad slower. I personally prefer the
first form becau...
Ruby RegexHello,
I am working on extracting some data from a file.
Sample data in the file are as follows:
Case 1: Direction abc,(xyz)
Case 2: Direction fet
I want to extract the content after Direction but before the comma(if
present).
The issue I am facing is that the comma is not always present.
Otherwise a reg exp like:
reg_exp = %r{Direction(.+),}
would have given me the content.
This would not work in the 2nd case.
How to account for both the conditions.
Any help would be appreciated...
--
Posted via http://www.ruby-forum.com/.
On 09.04.2009 16:44, Sriram Varahan wrote:
> Hello...
regexi would like to seek out "def" from this below expression:
my $str2;
my $str = "<abc>def</abc>";
if ($str =~ /abc/) {
$str2 = # want to put "def" in $str2;
}
how can i write it properly?
Thanks for any reply.
On 04/09/15 07:42, Wandy Tang wrote:
> i would like to seek out "def" from this below expression:
>
> my $str2;
> my $str = "<abc>def</abc>";
IF you simply want to pick out what is between the character strings
<abc> and </abc> then this will do it:
my $str2;
my ...
regexI want to match mailto:null@void.com......gif in a string that contains many
similar patterns.
I used "mailto:(.[^"]*)" to match each "mailto: ..." string. The parans
then allowed me to get at the email address.
But now I realize I need more info from each match.
I need to extend the match to the first 'gif' (the characters 'gif' would be
the end of the string instead of ' " ' as in my first regex.) but I am
having some trouble doing so.
I have tried a number of different combinations but without the match I
need.
I know what I need. ...
regexHi for everyone, i need to parse a text and i need to found a text like this:
<objInformation name="<%=Property.name%> version="1">
I try to parse this with this pattern but don't work:
<objInformation(\s+\w+\s*=\s*([(["|']?<\s*%\s*=\s*Property.\w+\s*%\s*>["|']?)
|(["|']?\w+["|']?)]))*>
Anybody what is wrong in this regular expresion?
Thanks,
Alejandro
"a_narancio@hotmail.com (Alejandro Narancio)" wrote in comp.lang.java:
> Hi for everyone, i need to parse a text and i need to fo...
RegExwhy my program not work?
wxString x = "Hello";
wxString y = "world";
wxString n = "123";
wxRegEx *r = new wxRegEx("e[a-z]*o");
wxRegEx r2("/[a-z]*/");
wxPrintf(_("regex [%s]\n"),r->GetMatch(x).mb_str());
I would lige to get "ello"
At 13:45 30.01.2008 +0100, Zorro wrote:
>why my program not work?
>
> wxString x = "Hello";
> wxString y = "world";
> wxString n = "123";
> wxRegEx *r = new wxRegEx("e[a-z]*o");
> wxRegEx r2("/[a-...
RegExIs there is a good video lesson out there that focuses on RegEx for use
specifically in GNU bash or C11.
--
Marek Novotny
https://github.com/marek-novotny
In article <wOqdnaQT4rX53G7JnZ2dnUU7-U2dnZ2d@giganews.com>,
Marek Novotny <marek.novotny@marspolar.com> wrote:
> Is there is a good video lesson out there that focuses on RegEx for use
> specifically in GNU bash or C11.
I don't know if there's any video, but
http://www.regular-expressions.info/ is a good place to start looking
for tutorials on regexp.
--
Barry Margolin, barmar@alum.mit.edu...
regexI'm digging through the Pragmatic Programmers book and had some
questions about regex support.
Initially they only mention .sub and .gsub.
If I wanted to write a regex block using additional flags, say something
like this:
s/perl/ruby/igsm
What that be expressed as:
"my favorite programming language is perl".gsub(/perl/ism, 'ruby')
???
What about the 'x' option?
Tom Allison wrote:
> I'm digging through the Pragmatic Programmers book and had some
> questions about regex support.
>
> Initially they only mention .sub and .gsub.
>
> If...
regexHi,
What's the right expression to find exponent and argument in:
sin<sup>2</sup>(B/2 - C/2) ?
I need to change it to: sin(B/2 - C/2)^2
I've tried with "(sin|cos|tan|cot|sec|csc)<sup>(\d)+</sup>\(*\)" but
this string is not compiled with Wild2RegEx()
Also, I tried with "(sin|cos|tan|cot|sec|csc)<sup>(\d)+</sup>(*)".
This is compiled by with Wild2RegEx() but element in HB_RegExAll()
loses the right ")"
Thanks a lot in advance
Cesar Lozada
>
> What's the right expression to find exponent and argument in:...
regexhi all, was hoping someone could provide a regex for the following
situation - im pulling my hair out
thanks
PP
--------
Q) password needs to contain at least one number and have a minimum length
of 6
Psybar Phreak wrote on 27 sep 2003 in comp.lang.java.javascript:
> hi all, was hoping someone could provide a regex for the following
> situation - im pulling my hair out
Already answered elswhere.
Please do not multipost !!!
And leave your hair alone ;-}
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
...
regexHi, in this regex I have two different results but why?Pattern p = Pattern.compile("[a-z&&[def]]");Matcher m = p.matcher("adef");boolean b = m.find(); // trueboolean b2 = Pattern.matches("[a-z&&[def]]", "adef"); // falseIf I try to use another regex tool as RegexBuddy I also have falseBut the is the intersection a regex standard feature?Thanks On 20/06/2007 12:45, josh wrote:> Hi, in this regex I have two different results but why?> > Pattern p = Pattern.compile("[a-z&&[def]]");> Matcher m = p.matcher("a...
RegexHi!
I am making a website with PHP (of course) and have to make this
transformation: <l>name</l> to <a href="blabla.php?id=name">name</a>
How do I do that? Will I have to use several regex or is it possible that I
can use only one?
--
Greetings/Martin Nielsen-L�nn
Martin Nielsen-L�nn wrote:
> I am making a website with PHP (of course) and have to make this
> transformation: <l>name</l> to <a href="blabla.php?id=name">name</a>
> How do I do that?
preg_replace("/<l>(.*?)<\/l>/" "<...