473,326 Members | 2,108 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Regular expressions

110 100+
I am trying to fetch "portal[portal] @ localhost [127.0.0.1]" info out of "User@Host: portal[portal] @ localhost [127.0.0.1]" I am trying to use negative lookahead for excluding user@host pattern.. like this, "(?!\\b(# User@Host: )\\b)\\b.*" but the problem is, the regex engine does not seem to work for a combination of a special character and a normal character.. if "@" is removed it works fine.. anybody experienced this sort of difficulty?? please help..thanks in Advance.. Xoinki
May 7 '08 #1
4 1515
gpraghuram
1,275 Expert 1GB
I am trying to fetch "portal[portal] @ localhost [127.0.0.1]" info out of "User@Host: portal[portal] @ localhost [127.0.0.1]" I am trying to use negative lookahead for excluding user@host pattern.. like this, "(?!\\b(# User@Host: )\\b)\\b.*" but the problem is, the regex engine does not seem to work for a combination of a special character and a normal character.. if "@" is removed it works fine.. anybody experienced this sort of difficulty?? please help..thanks in Advance.. Xoinki

R u using any regex package or in which language u are trying to implement this?

raghuram
May 8 '08 #2
xoinki
110 100+
hi,
Thanks for d reply, I am using C++ and i am using PCRE(www.pcre.org), I found out another thing.. lets say the pattern to be matched is "@H portal[portal]@localhost" and the regex for extracting "portal[portal]@localhost" i would use "(?!@H).*" meaning: except @H match everything else.. this should match "portal[portal]@localhost" in theory but it is matching "H portal[portal]@localhost" so the combination of alphabets and special characters is causing the problem i found out! I am unable to findout whether this is a problem with PCRE or with my understanding and logic. looking for your help,
Xoinki
May 8 '08 #3
gpraghuram
1,275 Expert 1GB
hi,
Thanks for d reply, I am using C++ and i am using PCRE(www.pcre.org), I found out another thing.. lets say the pattern to be matched is "@H portal[portal]@localhost" and the regex for extracting "portal[portal]@localhost" i would use "(?!@H).*" meaning: except @H match everything else.. this should match "portal[portal]@localhost" in theory but it is matching "H portal[portal]@localhost" so the combination of alphabets and special characters is causing the problem i found out! I am unable to findout whether this is a problem with PCRE or with my understanding and logic. looking for your help,
Xoinki
I havent used pcre.
I have used Lex to do similar type and i use to use [^ to negate matched patterns.

Raghuram
May 8 '08 #4
xoinki
110 100+
[^ is used to negate character classes.. not strings..
If we want to exclude strings then
1) either we need to use negative lookahead as i am trying.
2) or replace the not required pattern.
3) or just use pure C++.

I am trying with 1 not yet went for 2 and 3.. PCRE is same as any other regex..

thnx for replying,
Xoinki
May 8 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Michael McGarry | last post by:
Hi, I am horrible with Regular Expressions, can anyone recommend a book on it? Also I am trying to parse the following string to extract the number after load average. ".... load average:...
1
by: Kenneth McDonald | last post by:
I'm working on the 0.8 release of my 'rex' module, and would appreciate feedback, suggestions, and criticism as I work towards finalizing the API and feature sets. rex is a module intended to make...
2
by: Sehboo | last post by:
Hi, I have several regular expressions that I need to run against documents. Is it possible to combine several expressions in one expression in Regex object. So that it is faster, or will I...
4
by: Együd Csaba | last post by:
Hi All, I'd like to "compress" the following two filter expressions into one - assuming that it makes sense regarding query execution performance. .... where (adate LIKE "2004.01.10 __:30" or...
7
by: Billa | last post by:
Hi, I am replaceing a big string using different regular expressions (see some example at the end of the message). The problem is whenever I apply a "replace" it makes a new copy of string and I...
3
by: a | last post by:
I'm a newbie needing to use some Regular Expressions in PHP. Can I safely use the results of my tests using 'The Regex Coach' (http://www.weitz.de/regex-coach/index.html) Are the Regular...
25
by: Mike | last post by:
I have a regular expression (^(.+)(?=\s*).*\1 ) that results in matches. I would like to get what the actual regular expression is. In other words, when I apply ^(.+)(?=\s*).*\1 to " HEART...
1
by: Allan Ebdrup | last post by:
I have a dynamic list of regular expressions, the expressions don't change very often but they can change. And I have a single string that I want to match the regular expressions against and find...
13
by: Wiseman | last post by:
I'm kind of disappointed with the re regular expressions module. In particular, the lack of support for recursion ( (?R) or (?n) ) is a major drawback to me. There are so many great things that can...
12
by: FAQEditor | last post by:
Anybody have any URL's to tutorials and/or references for Regular Expressions? The four I have so far are: http://docs.sun.com/source/816-6408-10/regexp.htm...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.