Page 1 of 1

Delete Before and After

Posted: Mon Mar 22, 2010 1:46 am
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.

Re: Delete Before and After

Posted: Mon Mar 22, 2010 10:53 am
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

Re: Delete Before and After

Posted: Mon Mar 22, 2010 3:31 pm
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

Re: Delete Before and After

Posted: Tue Mar 23, 2010 9:06 am
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

Re: Delete Before and After

Posted: Tue Mar 23, 2010 9:29 am
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.

Re: Delete Before and After

Posted: Tue Mar 23, 2010 9:54 am
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.

Re: Delete Before and After

Posted: Tue Mar 23, 2010 10:20 am
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.

Re: Delete Before and After

Posted: Tue Mar 23, 2010 4:18 pm
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