#1
|
|||
|
|||
Delete content next to a word.
As you can see in this image: http://i.gyazo.com/8996a86cf19862e36838e56c3ebcc6c2.png
I want to delete all the text at the left of "lbs" and the word lbs as well, leaving only the (amount kg) In case it's possible, I want to eliminate the parentesis, leaving only the "amount kg" It's a really long list, so I just want to do it by replacing, but I don't know how to do it. Thank you. |
#2
|
||||
|
||||
You can do that with a wildcard Find/Replace, where;
Find = [!^13]@([0-9.]@ kg)*^13 Replace = \1^p
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Trying to decipher
I find myself once again puzzled by a wildcard search.
As I read your Find terms, you're telling Word to not find one or more hard returns followed by a term, designated by parentheses, comprising one or more numerals followed by a period and a space, which term is then followed by another space and then kg. This is then followed by any number of other characters and then a hard return. My questions, if you would be so kind, are: 1. Is the return avoidance at the beginning actually another way of saying "1 or more of any characters (except that)? Is this used because, say, [?!^13]@ would not for some reason? 2. Why the two spaces after the number of kgs? 3. Why the asterisk after kg? Is this to eliminate the close peren? Thanks. |
#4
|
||||
|
||||
Quote:
• [!^13] represents any character other than a paragraph break, so [!^13]@ says to find a sequence of such characters. • ([0-9. ]@ kg) says to find & store any sequence of 0-9 and /or a period followed by ' kg'. The parens in the expression do not represent the parens in the text - they're the std wildcard expression for storing a string. • there are no "spaces after the number of kgs" • the *^13 after kg) says to find any number of characters after the 'kg' until a paragraph break is found.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
Spaces and terms
Thank you for clarifying. One thing I learned from this is that the use of the backslash and a number in the replacement field refers only to a terms defined by being enclosed in parentheses, which is why \1 in this expression ignores anything before the open paren.
I am still not entirely clear, however, about the use of spaces, which I didn't state clearly enough. Your expression has a space between the period and the close bracket, and one between the @ and kg. A special wildcard lookup table I have suggests that these may be necessary to separate items in an expression, but that if a space needed to be indicated, ^w would have to be used. Is this correct? Thank you, sir. |
#6
|
||||
|
||||
Quote:
Quote:
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Prevent automatic movement of content due to insertion of other content | Magistus | OneNote | 1 | 11-19-2014 02:27 PM |
Excel found unreadable content in file.xls. Do you want to recover the content of this workbook? | Sanfran | Excel | 2 | 10-21-2014 12:09 AM |
Multiple Userforms Displaying Different Content but Returning Same Content? | marksm33 | Word VBA | 1 | 02-24-2014 06:17 PM |
How can I delete the content of a cell in column if the cell value is more than 1000? | Learner7 | Excel | 2 | 06-27-2011 05:44 AM |
Package for CD with links to Windows media player content and Flash Shockwave content | hectorh | PowerPoint | 4 | 10-15-2009 12:22 PM |