Delete Before and After

Get help with installation and running here.

Moderators: DataMystic Support, Moderators, DataMystic Support, Moderators, DataMystic Support, Moderators

Post Reply
thenquirer
Posts: 3
Joined: Mon Mar 22, 2010 1:41 am

Delete Before and After

Post by thenquirer »

Hello there,

How do i remove anything before a word in a text passage. For example,
What Petraeus said is this: "The [Israeli-Arab] conflict foments anti-American sentiment, due to a perception of U.S. favoritism for Israel. Arab anger over the Palestinian question limits the strength and depth of U.S. partnerships with governments and peoples ? and weakens the legitimacy of moderate regimes in the Arab world. Meanwhile, al-Qaida and other militant groups exploit that anger to mobilize support. The conflict also gives Iran influence in the Arab world through its clients, Lebanese Hizballah and Hamas."
How do i remove anything before the word <"The>.

-Thenq.
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Delete Before and After

Post by DataMystic Support »

Sounds like a troll to me, but use a perl pattern search/replace for:

Code: Select all

^(.*)("The)
Replace with

Code: Select all

$2
pakiyabhai
Posts: 8
Joined: Tue Feb 09, 2010 7:26 pm

Re: Delete Before and After

Post by pakiyabhai »

this didn't work for me.

Did it work for you ? For me it doesn't do anything. I tried using perl search replace only
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Delete Before and After

Post by DataMystic Support »

Works perfectly here - this is the pattern match:

Code: Select all

|--Perl pattern [^(.*)("The)] with [$2]
|     [ ] Match case
|     [ ] Whole words only
|     [ ] Case sensitive replace
|     [X] Prompt on replace
|     [ ] Skip prompt if identical
|     [ ] First only
|     [ ] Extract matches
|     Maximum text buffer size 4096
|     [ ] Maximum match (greedy)
|     [ ] Allow comments
|     [X] '.' matches newline
|     [ ] UTF-8 Support
thenquirer
Posts: 3
Joined: Mon Mar 22, 2010 1:41 am

Re: Delete Before and After

Post by thenquirer »

Hi,

Can i know why the replacement is $2 instead of $1? If additional to removing the text infront, i want to remove everything after the text "to mobilize support.", what is the correct syntax and replacement that should be used?

-Thenq.
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Delete Before and After

Post by DataMystic Support »

You could always read the manual...

$1 contains all the text prior to "The

Use EasyPattern search/replace

Code: Select all

to mobilize support.[ longest 1+ not cr or lf ]
Replace with

Code: Select all

to mobilize support.
thenquirer
Posts: 3
Joined: Mon Mar 22, 2010 1:41 am

Re: Delete Before and After

Post by thenquirer »

I did but i cant seem to search for symbols in the chm file. Sorry, i'm still trying to get used to it. I've been looking to manipulate data like texts, to remove before and after. Also to add strings if its not present. For example, if i want to add "Report Checked" to the end of the file if it does not exist, is it feasible? Thanks.

-Thenq.
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Delete Before and After

Post by DataMystic Support »

Yes, search for perl pattern:

Code: Select all

.*?Report Checked.*?
Set Action to: Send non-matching text to subfilter

Then Add an Add Footer filter as a subfilter, with text of

Code: Select all

Report Checked
Post Reply