Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-27-2015, 06:18 PM
Martinengo Martinengo is offline Delete content next to a word. Windows 8 Delete content next to a word. Office 2013
Novice
Delete content next to a word.
 
Join Date: Jan 2015
Posts: 1
Martinengo is on a distinguished road
Default 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.
Reply With Quote
  #2  
Old 01-27-2015, 07:25 PM
macropod's Avatar
macropod macropod is offline Delete content next to a word. Windows 7 64bit Delete content next to a word. Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
  #3  
Old 01-28-2015, 12:08 PM
Ulodesk Ulodesk is offline Delete content next to a word. Windows 7 64bit Delete content next to a word. Office 2013
Word 2013 Expert Cert
 
Join Date: Sep 2009
Location: Virginia
Posts: 866
Ulodesk is on a distinguished road
Default 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.
Reply With Quote
  #4  
Old 01-28-2015, 02:40 PM
macropod's Avatar
macropod macropod is offline Delete content next to a word. Windows 7 64bit Delete content next to a word. Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by Ulodesk View Post
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.
Breaking down the expression:
• [!^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]
Reply With Quote
  #5  
Old 01-28-2015, 03:04 PM
Ulodesk Ulodesk is offline Delete content next to a word. Windows 7 64bit Delete content next to a word. Office 2013
Word 2013 Expert Cert
 
Join Date: Sep 2009
Location: Virginia
Posts: 866
Ulodesk is on a distinguished road
Default 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.
Reply With Quote
  #6  
Old 01-28-2015, 04:25 PM
macropod's Avatar
macropod macropod is offline Delete content next to a word. Windows 7 64bit Delete content next to a word. Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by Ulodesk View Post
Your expression has a space between the period and the close bracket, and one between the @ and kg.
That was an error in the posted expression, which I've now fixed.
Quote:
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?
No, if you need to indicate an space, as distinct from any whitespace (which includes tabs & non-breaking spaces), you'd insert an actual space as I have done. In any event, ^w isn't valid in a wildcard Find expression so, if you wanted to capture all whitespace characters, you'd have to specifically add each one to the expression (e.g. [ ^0160^t]).
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete content next to a word. Prevent automatic movement of content due to insertion of other content Magistus OneNote 1 11-19-2014 02:27 PM
Delete content next to a word. 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
Delete content next to a word. 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

Other Forums: Access Forums

All times are GMT -7. The time now is 06:20 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft