Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Wildcard pattern matching and replace in string
Well, having spent pretty much all day on this "little"
project that sounded so easy originally, I finally found RegExp & its wonderful pattern-matching capabilities. And I finally found enough help on the topic to put something together that works, even if I'm not completely sure how. -----Original Message----- Ok, here's a "fun" one... Running Excel 97. I have 2 files. The first file is a 12,000 line partsbook that has a bunch of old numbers in it that need to be replaced. The second file is a list of over 7,000 old numbers and the new ones that replace them. The partsbook is actually a text file, but I've also imported it into Excel, so I could use either format for this. The first problem is that each line is 558 characters long. The second problem is that there's really no good way to split it into columns, since there are multiple line types and each type has a different arrangement. My first thought was to loop through the replacement list, searching each line of the partsbook for each number in the list. It would work fabulously if I had a couple extra years and a spare computer.... The old part numbers are in the format #.###.####.# or ############## What I'd like to do is search each line of the partsbook for anything that matches those patterns, then do a simple lookup to find the replacement number and replace the old number with the new number. But I can't figure out how to do a pattern matching search AND capture the resulting string AND replace it. Any ideas? . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Keep text matching a wildcard spec in replace/substitute | Excel Worksheet Functions | |||
Pattern Matching | Excel Discussion (Misc queries) | |||
Replace pattern of characters | Excel Discussion (Misc queries) | |||
pattern matching possible? | Excel Worksheet Functions | |||
Wildcard string | Excel Discussion (Misc queries) |