Deleting full words after certain length (after 36 char)
-
Hi Guys,
Please help me in removing all words after 36 characters as below example.
Source
<NAME>GOOGLE-YOUTUBEPREMIUM (Length 27 char)
<NAME>APPLE.COM-BILL 866-712-7753 ON (Length 36 char)
<NAME>GOOGLE-YOUTUBEPREMIUM INTERNET NS (Length 39 char)
<NAME>AMZN Mktp CA-2P5L787T1 WWW.AMAZON.CAON (Length 44 char)Result
<NAME>GOOGLE-YOUTUBEPREMIUM
<NAME>APPLE.COM-BILL 866-712-7753 ON
<NAME>GOOGLE-YOUTUBEPREMIUM INTERNET
<NAME>AMZN Mktp CA-2P5L787T1Thanks for you help.
-
@Net-Buyer said in Deleting full words after certain length (after 36 char):
Please help me in removing all words after 36 characters as below example.
You could try the following using the Replace function.
Find What:(?-s)^(?=.{37,})(.{1,36})\s.*
Replace With:$1
Search mode must be “Regular expression”.As some background we have
(?-s) - DOT character does NOT include the newline characters
^(?=.{37,}) - check if the line is 37 characters or more, otherwise we don’t process it
(.{1,36})\s.* - look for up to 36 characters followed by a space (blank), this is captured in group 1, select the remainder of the line, but don’t capture it.
$1 - means return the captured portion only, thus the first (up to) 36 characters are
written back.Terry
-
@Terry-R : Thanks for your help. Worked like charm.