|
![]() |
|
| Author |
|
|||||||
|
Hogfather
Posts: 880
Location: Cairns, Queensland
|
Hey -
I have a HUGE list of VC++ dialog IDs that I need to seperate to name and number and chuck into a excel spreadsheet, in the format below: IDD_TRIALEXPIRED 130 IDD_ENTERREGISTRATION 131 IDD_REGISTRATION 136 IDD_GROUP_PERMISSIONS 149 IDD_LOGIN 154 IDD_JOBBOOK_DETAILS 163 IDD_JOBBOOK_TRADES 168 IDD_ESTIMATESUMMARY 173 IDD_JOBBOOK_CONTACTS 187 IDD_ORDERS 190 IDD_BROWSEODBC 191 IDD_SEARCHJOB 192 IDD_JOBBOOK_COSTING 194 IDD_VARIATIONPROPERTIES 209 IDD_PROPS_PART 211 IDD_PROPERTIES_INVOICE 212 IDD_PROPERTIES_SUBCONTRACTORSQUOTE 216 IDD_NEWSECTION 217 IDD_MAT_EQUIV 217 IDD_MODULE_PROPERTIES 218 IDD_EDITSECTIONLABOUR 219 IDD_ORDERDETAILS 220 IDD_PROCESSDELIVERY 221 IDD_SEARCHDELIVERY 222 I have a text editor (Textpad) that will allow me to do regular expression search and replace, but I'm utterly s***house at them. I'm sure there's someone here who has REs fresh in their mind who might not mind working this one out? I need to replace (using gumby RE notation that won't work): IDD_[A-Z]*[" "]*[1-0]* with the IDD_[A-Z]* bit, and in a seperate search, the [1-0]* bit. If you know RE's hopefully this will make sense. Thanks heaps in advance for any help. Kind of busy on this or I would have worked a dragon, ninja, pirate or kat flame in somewhere for ya. |
|||||||
| #0 12:27pm 20/01/06 |
|
|||||||
|
system
|
--
|
|||||||
| #0 |
|
|||||||
|
Khel
Posts: 11171
Location: Wynnum, Queensland
|
I don't really understand regex, but if the list is currently in the format you posted above, and you wan't to import into excel, couldn't you just do normal search and replace, replace all spaces with commas and import it as csv?
|
|||||||
| #1 12:31pm 20/01/06 |
|
|||||||
|
Hogfather
Posts: 881
Location: Cairns, Queensland
|
Spaces are not singular, assuming I dont stuff up the HTML it looks like this really:
IDD_TRIALEXPIRED 130
Grr. Anyway, theres an indeterminate amount of whitespace between the IDDs and the numbers ... last edited by Hogfather at 12:39:59 20/Jan/06 |
|||||||
| #2 12:39pm 20/01/06 |
|
|||||||
|
stinky
Posts: 1414
Location: Brisbane, Queensland
|
IDD_SEARCHDELIVERY 222 /^(.*?)\s+(.*?)$/ $1 - IDD_SEARCHDELIVERY $2 - 222 |
|||||||
| #3 12:49pm 20/01/06 |
|
|||||||
|
trog
AGN Admin
Posts: 17942
Location: Brisbane, Queensland
|
try /(.*)(\s+)(.*)/
The IDD_ should get matched in the first brackets and the value in the third. I think. I'm rusty on perl regexps (which I assume it uses) as I've been using PHP ones for so long. |
|||||||
| #4 12:49pm 20/01/06 |
|
|||||||
|
trog
AGN Admin
Posts: 17943
Location: Brisbane, Queensland
|
Oh yeh, stinky's is better. I always forget the question mark in (.*?) - what is that for again, its to stop "greedy" matching (or does it force it)?
|
|||||||
| #5 12:50pm 20/01/06 |
|
|||||||
|
stinky
Posts: 1415
Location: Brisbane, Queensland
|
\s+ = whitespace
|
|||||||
| #6 12:51pm 20/01/06 |
|
|||||||
|
stinky
Posts: 1416
Location: Brisbane, Queensland
|
yeah, stops greedy. i.e. it tells it to stop when it matches the next part of the regex i.e. \s+ otherwise it would *possibly* pick up the whole string as $1
|
|||||||
| #7 12:52pm 20/01/06 |
|
|||||||
|
Thundercracker
Posts: 1269
Location: Brisbane, Queensland
|
Im no regex expert but would you use 0-9 instead of 1-0?
|
|||||||
| #8 12:57pm 20/01/06 |
|
|||||||
|
Hogfather
Posts: 882
Location: Cairns, Queensland
|
Im no regex expert but would you use 0-9 instead of 1-0? Yeh you're right. Like I said, I suck at regex :p Thanks for all the replies guys! Something I definetly need to dust off and play with is a bit of regexing. |
|||||||
| #9 03:35pm 20/01/06 |
|
|||||||
|
trog
AGN Admin
Posts: 17947
Location: Brisbane, Queensland
|
http://qgl.ausforums.com/?agn=thread&id=1917484 might come in handy
|
|||||||
| #10 03:41pm 20/01/06 |
|
|||||||
|
infi
Posts: 2906
Location: Brisbane, Queensland
|
i thought this was going to be an emo thread.
|
|||||||
| #11 03:43pm 20/01/06 |
|
|||||||
|
Hogfather
Posts: 884
Location: Cairns, Queensland
|
Nice link trog!
|
|||||||
| #12 03:46pm 20/01/06 |
|
|||||||
|
trog
AGN Admin
Posts: 17948
Location: Brisbane, Queensland
|
luckily I remember every interesting thing that's ever been posted!@#
|
|||||||
| #13 03:52pm 20/01/06 |
|
|||||||
|
system
|
--
|
|||||||
| #13 |
|
|||||||
|
| ||||||||