Hello!
I am experiencing some difficulties.
Could You help me?
Is it possible to find a string of the form (html file):
<tr class="OutOfBlock"><td /><td>DD.MM.YYYY</td><td>HH:MM:SS</td><td>+HH:00</td><td>some text with ()_:,. etc.</td><td>some text with ()_:,. etc.</td><td></td><td>some text with ()_:,. etc.</td><td></td><td>some text with ()_:,. etc.</td><td>0,0000</td><td /></tr>
and remove it if in the end found "0,0000"?
*the date and time, timezone variable.
In advance i thank you for the assistance provided.
Best regards.
find and remove pattern
- DigitalVolcano
- Site Admin
- Posts: 1863
- Joined: Thu Jun 09, 2011 10:04 am
Re: find and remove pattern
This should find the block-
note the escaped characters and the wildcards.
You can replace with nothing to remove the strings. Always backup first!
Code: Select all
<tr class="OutOfBlock"><td /><td>DD\.MM\.YYYY</td><td>HH:MM:SS</td><td>\+HH:00</td><td>.*?</td><td>.*?</td><td></td><td>.*?</td><td></td><td>.*?</td><td>0,0000</td><td /></tr>
You can replace with nothing to remove the strings. Always backup first!
Re: find and remove pattern
Hmmm, ... I have a html file containing some similar lines, here are some (internal code) of them:
For example, upon detection of template <tr ... 0,0000 ... </ tr> this line is removed.
* When I enter your expression, nothing happens (probably need to convert, for example, to search for <tr need to write \<tr etc.)
Is this possible?
Thank you.
after applying the script patterns (<tr ... </tr>) containing 0,0000 must be removed.<tr class="OutOfBlock"><td /><td>01.11.2014</td><td>17:15:43</td><td>+03:00</td><td>smsvsr_723</td><td>Location: asdfgh</td><td></td><td>sms o</td><td></td><td>1</td><td>3,3474</td><td /></tr>
<tr class="OutOfBlock"><td /><td>01.11.2014</td><td>17:16:05</td><td>+03:00</td><td></td><td>Location: zxcvbn</td><td></td><td>ussd</td><td>U</td><td>1</td><td>0,0000</td><td /></tr>
<tr class="OutOfBlock"><td /><td>27.11.2014</td><td>10:32:26</td><td>+03:00</td><td>smsvsr_1234</td><td>Location: qwerty</td><td></td><td>sms o</td><td></td><td>1</td><td>0,0000</td><td /></tr>
For example, upon detection of template <tr ... 0,0000 ... </ tr> this line is removed.
* When I enter your expression, nothing happens (probably need to convert, for example, to search for <tr need to write \<tr etc.)
Is this possible?
Thank you.
- DigitalVolcano
- Site Admin
- Posts: 1863
- Joined: Thu Jun 09, 2011 10:04 am
Re: find and remove pattern
It's probably because the expression literally looks for HH.MM.SS, etc. I didn't realize that they were placeholders for actual values in the file.
This may work, if it's not too nonspecific:
This may work, if it's not too nonspecific:
Code: Select all
<tr class="OutOfBlock"><td /><td>.*?</td><td>.*?</td><td>.*?</td><td>.*?</td><td>.*?</td><td></td><td>.*?</td><td></td><td>.*?</td><td>0,0000</td><td /></tr>
Re: find and remove pattern
Unfortunately, beginning marker is set incorrectly:
instead remove only the second line, the script removes both
Is there a solution?
instead remove only the second line, the script removes both
Code: Select all
<tr class="OutOfBlock"><td /><td>DD.MM.YYYY</td><td>HH:MM:SS</td><td>+HH:MM</td><td></td><td></td><td></td><td></td><td></td><td></td><td>40,0000</td><td /></tr>
<tr class="OutOfBlock"><td /><td>DD.MM.YYYY</td><td>HH:MM:SS</td><td>+HH:MM</td><td></td><td></td><td></td><td></td><td></td><td></td><td>0,0000</td><td /></tr>