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

Help with Regex to parse dlg template controls

I hope this is the appropriate group for this question--the regex
group didn't look too appealing.

I am trying to build a regex to parse out dialog controls from C++ RC
files. Suppose the input text is:

IDD_ADDPRINTDLG DIALOGEX 0, 0, 284, 87
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP
FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN
CONTROL "Color",IDC_COLOR,"Button",BS_AUTORADIOBUTTON,
11,68,33,14
CONTROL "Grayscale ""Quoted Text
""",IDC_GRAYSCALE,"Button",BS_AUTORADIOBUTTON,50,6 8,47,14
CONTROL "Faxable
Image",IDC_FAX,"Button",BS_AUTORADIOBUTTON,103,68, 59,14
GROUPBOX "Printing Options",IDC_PDOPTIONS,8,59,271,26
GROUPBOX "Footer Text",IDC_FOOTERBOX,8,4,272,51
EDITTEXT IDC_FOOTER,13,13,262,40,ES_MULTILINE |
ES_WANTRETURN
END

If I use the regex (EDITTEXT|CONTROL|GROUPBOX|LTEXT|PUSHBUTTON|
DEFPUSHBUTTON)\s+("(?<ControlText>.*?)",\s*)?(?<Id entifier>\w+),[\v\f
\S]+\n

it finds everything except the EDITTEXT line, which doesn't have the
optional ControlText field. I've stared at this for a few hours now
trying to figure why it can't find it. Any ideas?

Thank you.

-Ben
Dec 13 '07 #1
1 1624
On Dec 13, 9:20 am, pepethecow <pepethe...@gmail.comwrote:
I hope this is the appropriate group for this question--the regex
group didn't look too appealing.

I am trying to build a regex to parse out dialog controls from C++ RC
files. Suppose the input text is:

IDD_ADDPRINTDLG DIALOGEX 0, 0, 284, 87
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP
FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN
CONTROL "Color",IDC_COLOR,"Button",BS_AUTORADIOBUTTON,
11,68,33,14
CONTROL "Grayscale ""Quoted Text
""",IDC_GRAYSCALE,"Button",BS_AUTORADIOBUTTON,50,6 8,47,14
CONTROL "Faxable
Image",IDC_FAX,"Button",BS_AUTORADIOBUTTON,103,68, 59,14
GROUPBOX "Printing Options",IDC_PDOPTIONS,8,59,271,26
GROUPBOX "Footer Text",IDC_FOOTERBOX,8,4,272,51
EDITTEXT IDC_FOOTER,13,13,262,40,ES_MULTILINE |
ES_WANTRETURN
END

If I use the regex (EDITTEXT|CONTROL|GROUPBOX|LTEXT|PUSHBUTTON|
DEFPUSHBUTTON)\s+("(?<ControlText>.*?)",\s*)?(?<Id entifier>\w+),[\v\f
\S]+\n

it finds everything except the EDITTEXT line, which doesn't have the
optional ControlText field. I've stared at this for a few hours now
trying to figure why it can't find it. Any ideas?

Thank you.

-Ben

As usual, talking about it helped me figure it out on my own. The
problem was with the spaces around the pipe in the EDITTEXT line...
Dec 13 '07 #2

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

Similar topics

3
by: Mike | last post by:
Hey guys I am pulling my hair out on this problem!!!!! Any help or ideas or comments on how to make this work I would be grateful! I have been working on this for the past 4 days and nothing I do...
8
by: Johnny | last post by:
I need to determine whether a text box contains a value that does not convert to a decimal. If the value does not convert to a decimal, I want to throw a MessageBox to have the user correct the...
1
by: Martin Andert | last post by:
Hello, i want to parse some html with regex and have the following problem: --- html to parse start --- some text <span class="x"> some text with linebreaks and tabs and <b>tags <i>in...
4
by: ilPostino | last post by:
hi, I'm trying to write my own code-dom because I don't like the ms one ;-) I want to look for this expression, ( using someword; ) but I can only figure out basic things like searching for...
4
by: sasifiqbal | last post by:
Hi All, I have following text Template that needs to be parsed using Regular Expression -- Test Template This is a Test Template for <#OrderNumber/> Sender Message is <#SENDERMESSAGE/>
31
by: Extremest | last post by:
I have a loop that is set to run as long as the arraylist is > 0. at the beginning of this loop I grab the first object and then remove it. I then go into another loop that checks to see if there...
11
by: Steve | last post by:
Hi All, I'm having a tough time converting the following regex.compile patterns into the new re.compile format. There is also a differences in the regsub.sub() vs. re.sub() Could anyone lend...
3
by: Simon Brooke | last post by:
As various people will have noticed, I've been having a lot of trouble with XSL lately. Brief history: I wrote myself an XML toolkit back in 2000, and it worked well enough for me, so it's been...
3
by: =?Utf-8?B?c2JwYXJzb25z?= | last post by:
I have a scenario where a string is sent in chunks to my app. I need to be able to identify certain tags in this partial string as it arrives. eg <DALFile>xxxxxxxxx</DALFile> I need to be able...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.