#1
|
||||
|
||||
Help with WildCards Find & Replace either or nothing...
I need help, insights. Been searching for answers, even here in the forum of already discussed, and I don't seem to find it.
I've recently learned how to put different options in the last box, example below : [0-9]{1;}[*,.] // [\(][0-9]{1;}[\)][*,.] What I'm searching for is: 2, 4, 5 // (space then numbers 0-9, with a comma, and just a number at the end.) Would be the same thing with (2), (4), (5).// (same explanation as above, exept with a parenthese). and / or either a space before or nothing, then (4), (5), (6), (7) /// (NO space before the (4)) So what am I to do, when the last digit needs no coma or )? I thought the * would resolve this, since it's 0 charactere or more than 1, but it ignores the last digit in a cell. BTW, these are at the end of the cells, are like references, where I want to delete them. Any help? What am I doing wrong? Cendrinne |
#2
|
||||
|
||||
Your description is ambiguous. Some actual examples would be helpful.
For what you describe, you might try something like: Find = (2, 4, 5 // )(\([0-9]@,[0-9]@\))
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
||||
|
||||
I'm so sorry Paul, I thought I was clear. Good to know, I'll try to do better next time.
I'm not certain how to word it, so, I'll give you many intances of references at the end of the sentences. I'm wondering if you could find ALL of these different instances in one session of Manual Find and Replace (go to next) or do I have to do many different Manual Find and Replaces to successfully highlight all of the references (alphanumerical values)? See below. Some have space before the first alphanumerican value, some starts with an open brackets, others have space and commas in between values, others have only commas, and some have open and closed brakets. Is it possible to find them all? I've tested many different ways, with wildcards, wanted to highlight them, but only a few values where found, not all of them. Unless I do multiple Find and Replaces. Lorem ipsum dolor sit amet, magna aliqua (3,6,2) Lorem ipsum dolor sit amet, magna aliqua3), 6), 2) Ut enim ad minim veniam, quis nostrud (i) Ut enim ad minim veniam, quis nostrud(i), (ii), (iii) Duis aute irure dolor reprehenderit in voluptate velit (2) Duis aute irure dolor reprehenderit in voluptate velit 2) Duis aute irure dolor reprehenderit in voluptate velit(2) Duis aute irure dolor reprehenderit in voluptate velit2) Lorem ipsum dolor sit amet, magna aliqua 3,6,2 Lorem ipsum dolor sit amet, magna aliqua3, 6, 2 Is my explanation a little clearer? And is it doable, cause I'm ALWAYS missing a bunch of them. Any insights, I would be so ever greatful |
#4
|
||||
|
||||
Try:
Find = [\(0-9i]@[\(0-9i, \)]{1,} or: Find = [\(0-9i]@[\(0-9i, \)]{1;}
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
||||
|
||||
OMG, YES, it works. How did you figure it out??? The second one in my case, probably because my keyboard is in French or it's my layout. I've tried so long Trial and Error, and I got so many error, but you figured it out.
I'm am truly greatful. Thank you |
#6
|
||||
|
||||
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#7
|
||||
|
||||
Hummmmm, I've tried to add a-i, and it picked up letters at the start of the sentences.
[\(0-9a-i]@[\(0-9a-i, \)]{1;} Duis aute irure dolor reprehenderit in voluptate velit2) Ut enim ad minim veniam, quis nostrud (a) Ut enim ad minim veniam, quis nostrud(a), (b), (c) Ut enim ad minim veniam, quis nostrud a), b), c) without telling me the full solution, could you guide me as to what I need to look for? Cendrinne |
#8
|
||||
|
||||
Even with the Find expression from my previous reply there is the risk of false matches. For example:
Ut enim ad minim veniam, quis nostri (i), (ii), (iii) Duis aute irure dolor reprehenderit in voluptate veli(2) Lorem ipsum dolor sit amet, magna aliqui 3,6,2 Accordingly, in either case you need to check what is found.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#9
|
||||
|
||||
OK Thanks Paul. Been trying since my message and I couldn't come up with the solution. So now I know, at times, there is No formula that fits all instances. And we need to validate the query.
I'm deeply grateful Paul, Have yourself a great evening P.S.: by the way, I'll be taking a course soon, for beginners. I know I'm more advance than beginners, but I need to fill up grey areas, cause I've learned by analyzing, but missing some key basic component. |
#10
|
|||
|
|||
Perhaps a different approach. This works for your example:
Code:
Sub ScratchMacro() 'A basic Word macro coded by Greg Maxey Dim oRng As Range Dim oCell As Cell For Each oCell In Selection.Tables(1).Range.Cells Set oRng = oCell.Range If Len(oCell.Range.Text) > 2 Then oRng.Collapse wdCollapseEnd oRng.Move wdCharacter, -1 Do Until oRng.Characters.First.Previous Like "[A-Za-hj-uwyz.]" 'the Roman numberals could be a problem but few words end in 'i, v or x" oRng.Select oRng.MoveStart wdCharacter, -1 Loop oRng.HighlightColorIndex = wdBrightGreen 'or delete the range End If Next lbl_Exit: Exit Sub Last edited by gmaxey; 11-14-2020 at 04:23 PM. |
Tags |
find & replace w/ nothing |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Advanced Find and Replace with Wildcards help needed | Amapola188 | Word | 3 | 07-23-2019 10:54 PM |
Find and replace text with wildcards | arunchandar9 | Word VBA | 15 | 06-30-2019 01:06 AM |
Dissecting a hyperlink with Find Replace Wildcards | WeyldFalcon | Word | 4 | 11-15-2016 12:48 PM |
Using wildcards how do I Find and Add to, not replace | Stargehzer | Word | 3 | 01-25-2016 09:14 PM |
Find & Replace: Wildcards (except this pattern) | tinfanide | Word | 6 | 01-26-2014 06:39 AM |