473,289 Members | 1,842 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,289 software developers and data experts.

Problem with a Regular Expression in C. Need Help!

Guys,

I've got a regular expression that will just not work. I can't get it
work properly and I would like to see if someone out there can tell me
if I'm doing this wrong, or if there is a problem with the regex C
library for linux.

Here's my regular expression:

[<|\[]+(a|input|select|option|textarea|form|frame|iframe |area|base|link|icon:[\w]*)\s*(([^<>]|[^\[\]])*)[>|\]]
Now, this fails to match:
<icon:set name="bob" value="bob">

However, when I use this regular expression:

[<|\[]+(a|input|select|option|textarea|form|frame|iframe |area|base|link|icon:[\w]*)\s*(([^<>]|[^\[\]])*)[>]

it matches correctly. All I did was remove the |\] from the ending
character class. I really don't understand what I'm missing here.
If anyone has any suggestions, I would really appreciate it.

Thanks,
Mike Andrews
Farpointer Technologies, Inc.
Nov 13 '05 #1
2 1746
Mike Andrews wrote:
Guys,

I've got a regular expression that will just not work. I can't get it
work properly and I would like to see if someone out there can tell me
if I'm doing this wrong, or if there is a problem with the regex C
library for linux.

Here's my regular expression:

[<|\[]+(a|input|select|option|textarea|form|frame|iframe |area|base|link|icon:[\w]*)\s*(([^<>]|[^\[\]])*)[>|\]]
Now, this fails to match:
<icon:set name="bob" value="bob">

However, when I use this regular expression:

[<|\[]+(a|input|select|option|textarea|form|frame|iframe |area|base|link|icon:[\w]*)\s*(([^<>]|[^\[\]])*)[>]

it matches correctly. All I did was remove the |\] from the ending
character class. I really don't understand what I'm missing here.
If anyone has any suggestions, I would really appreciate it.

Thanks,
Mike Andrews
Farpointer Technologies, Inc.


Perhaps you are forgetting to escape your backslashes? i.e. '\' should be '\\'?

Nov 13 '05 #2
mi***@farpointer.net (Mike Andrews) wrote:
I've got a regular expression that will just not work.
And what makes you think regexes are part of ISO C?
I can't get it
work properly and I would like to see if someone out there can tell me
if I'm doing this wrong, or if there is a problem with the regex C
library for linux.


If there is, you'll find out about it in comp.unix.programmer.

Richard
Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

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...
5
by: Bradley Plett | last post by:
I'm hopeless at regular expressions (I just don't use them often enough to gain/maintain knowledge), but I need one now and am looking for help. I need to parse through a document to find a URL,...
11
by: Dimitris Georgakopuolos | last post by:
Hello, I have a text file that I load up to a string. The text includes certain expression like {firstName} or {userName} that I want to match and then replace with a new expression. However,...
10
by: Lee Kuhn | last post by:
I am trying the create a regular expression that will essentially match characters in the middle of a fixed-length string. The string may be any characters, but will always be the same length. In...
6
by: Ludwig | last post by:
Hi, i'm using the regular expression \b\w to find the beginning of a word, in my C# application. If the word is 'public', for example, it works. However, if the word is '<public', it does not...
6
by: deepak_kamath_n | last post by:
Hello, I am relatively new to the world of regex and require some help in forming a regular expression to achieve the following: I have an input stream similar to: Slot: slot1 Description:...
14
by: Chris | last post by:
I need a pattern that matches a string that has the same number of '(' as ')': findall( compile('...'), '42^((2x+2)sin(x)) + (log(2)/log(5))' ) = Can anybody help me out? Thanks for any help!
3
by: Mr.Steskal | last post by:
Posted: Wed Jul 11, 2007 7:01 am Post subject: Regular Expression Help -------------------------------------------------------------------------------- I need help writing a regular...
18
by: Lit | last post by:
Hi, I am looking for a Regular expression for a password for my RegExp ValidationControl Requirements are, At least 8 characters long. At least one digit At least one upper case character
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
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)...

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.