You are here: PSPad forum > English discussion forum > How to combine several regular expressions

How to combine several regular expressions

Goto Page: 1 2 3 4 5 Next

#1 How to combine several regular expressions

Posted by: maki | Date: 10/25/2017 18:30 | IP: IP Logged

How to combine (join) several regular expressions... please help.

1.
Code:
(?:<style.+?>.+?</style>|<script.+?>.+?</script>|<(?:!|/?[a-‌​zA-Z]+).*?/?>)

2.
Code:
(?<=<br>)[^\\\[\]\{\}]*?(?=(</br>|<br>))

3.
Code:
(?<=<p>)[^\\\[\]\{\}]*?(?=(</p>|<p>))

Edited 1 time(s). Last edit at 10/25/2017 18:30 by maki.

Options: Reply | Quote | Up ^


#2 Re: How to combine several regular expressions

Posted by: pspad | Date: 10/25/2017 18:34 | IP: IP Logged

Hello

pipe, the "|" symbol serves as OR operator.
you can use form:
(reg_expr1|reg_expr2|reg_expr3)
delimit all your 3 regular expressions with pipe and enclose with round brackets

Edited 1 time(s). Last edit at 10/25/2017 18:35 by pspad.

Options: Reply | Quote | Up ^


#3 Re: How to combine several regular expressions

Posted by: Andreas | Date: 10/25/2017 21:22 | IP: IP Logged

You also have to escape the slashes you are searching for.
/ => \/

Options: Reply | Quote | Up ^


#4 Re: How to combine several regular expressions

Posted by: maki | Date: 10/25/2017 22:23 | IP: IP Logged

I've tested a lot of regex but never removed 100% of HTML code.
Is there a best way to remove HTML or XHTML and leave only the plain text?

1.
Code: REMOVE
(?:<style.+?>.+?</style>|<script.+?>.+?</script>|<(?:!|/?[a-‌​zA-Z]+).*?/?>)
Here's something to add, change, improve to remove 100% of XHTML or HTML code

2. NOT REMOVE (text)
Code:
(?<=<br>)[^\\\[\]\{\}]*?(?=(</br>|<br>))

3. NOT REMOVE (text)
Code:
(?<=<p>)[^\\\[\]\{\}]*?(?=(</p>|<p>))

like how to remove var code, colors, more script, body and
<a></a> remove

Edited 3 time(s). Last edit at 10/25/2017 22:29 by maki.

Options: Reply | Quote | Up ^


#5 Re: How to combine several regular expressions

Posted by: pspad | Date: 10/25/2017 22:28 | IP: IP Logged

Hello

This is the right question. Yes, use function from the HTML menu - HTML / Conversion / Remove HTML tags.

Options: Reply | Quote | Up ^


#6 Re: How to combine several regular expressions

Posted by: maki | Date: 10/25/2017 22:33 | IP: IP Logged

But I need regex because I want to open "heavy file" in EmEditor 64-BIT (only this program opens big files, or with lots of HTML text)

Options: Reply | Quote | Up ^


#7 Re: How to combine several regular expressions

Posted by: pspad | Date: 10/25/2017 23:02 | IP: IP Logged

Download 64b version of PSPad from developer forum and use function I mentioned in my previous answer

Options: Reply | Quote | Up ^


#8 Re: How to combine several regular expressions

Posted by: maki | Date: 10/26/2017 09:14 | IP: IP Logged

64-bit

Bug 1:
Unable to delete tags in *.log (log file + html).
Not available option.
postimg.org

Bug 2: The Russian text changes
дравствуй, друг, по ту сторону экрана.

Bug3:
When try to select text (Bug 2), the text moves!

Edited 3 time(s). Last edit at 10/26/2017 09:16 by maki.

Options: Reply | Quote | Up ^


#9 Re: How to combine several regular expressions

Posted by: pspad | Date: 10/26/2017 12:11 | IP: IP Logged

maki:
64-bit

Bug 1:
Unable to delete tags in *.log (log file + html).
Not available option.
postimg.org

Bug 2: The Russian text changes
дравствуй, друг, по ту сторону экрана.

Bug3:
When try to select text (Bug 2), the text moves!

Hello

For 64b version you need to replace files with 32 b version first and than replace EXE. You will get localized PSPad will all missing functionality

1) It isn't bug. HTML like functions works for HTML based files only. Use menu View / Change syntax and change syntax to HTML. Same you can do with toolbar button or clicking on syntax name on the statusbar.

2) I don't understand. Do you mean after ussage of Remove HTML tag function?

3) How do you select text?

Options: Reply | Quote | Up ^


#10 Re: How to combine several regular expressions

Posted by: maki | Date: 10/26/2017 12:33 | IP: IP Logged

2) Open UTF-8 file or CP-1251 (log file). Text encoding wrong !!!
Please fix this.

3)I want to mark the wrong encodin Note: 2), the text is moving. Very stupid strange bug.

I still do not know how to remove 100% of log code, html and xhtml.

Edited 3 time(s). Last edit at 10/26/2017 12:37 by maki.

Options: Reply | Quote | Up ^


Goto Page: 1 2 3 4 5 Next





Editor PSPad - freeware editor, © 2001 - 2017 Jan Fiala
Hosted by Webhosting TOJEONO.CZ, design by WebDesign PAY & SOFT, code Petr Dvořák