You are here: PSPad forum > English discussion forum > How to combine several regular expressions
Posted by: maki | Date: 2017-11-01 11:35 | IP: IP Logged
pspad:maki:
<br>А __<br>Так же ", \"сонный\", \" убитый\". Глупоо человек доверяет мне.<br>It should only extract the text + tag <br> or >/br>
<br>А __<br>Так же ", \"сонный\", \" убитый\". Глупоо человек доверяет мне.<br>
Sorry, but it looks like you make fun of me. Both lines are same. Can you write text after using regular expression? Result what do you want to get.
post_type":"post","text":"#БП_Беларусь<br><br>Здравствуйте, Бумажные. <br>Пожалуйста \,<br>
Extract to:
<br>Здравствуйте, Бумажные. <br>Пожалуйста \,<br>
Posted by: pspad | Date: 2017-11-01 11:58 | IP: IP Logged
maki:The headercharset=windows-1251
means Cyrillic. You will have to change this to
charset=UTF-8
if you want to display the HTML in UTF-8 encodings.
The solution is:
How to Disable in PSPad ?
Detect HTML/XML Charset
Sorry. HTML/XML header doesn't tell nothing about encoding the document is stored in.
I don't work with HTML/XML documents, but with general text files. Any suggestion how to detect encoding in general text file?
If you want to disable CP autodetection in PSPad, open menu Encoding and uncheck autodetection.
Posted by: pspad | Date: 2017-11-01 12:01 | IP: IP Logged
maki:post_type":"post","text":"#БП_Беларусь<br><br>Здравствуйте, Бумажные. <br>Пожалуйста \,<br>
Extract to:
<br>Здравствуйте, Бумажные. <br>Пожалуйста \,<br>
This is a begin of line? Or is it a text somewhere in the middle of line?
Posted by: maki | Date: 2017-11-01 12:07 | IP: IP Logged
pspad:maki:post_type":"post","text":"#БП_Беларусь<br><br>Здравствуйте, Бумажные. <br>Пожалуйста \,<br>
Extract to:
<br>Здравствуйте, Бумажные. <br>Пожалуйста \,<br>
This is a begin of line? Or is it a text somewhere in the middle of line?
This is a begin of line? No.
Or is it a text somewhere in the middle of line? Yes.
Please change something in this regex to detect the entire text with the tags.
<br>под звучащие аккорды и в котором нам тепл</br><br>помог \ емерово.<br>
Posted by: pspad | Date: 2017-11-01 13:18 | IP: IP Logged
Try this expression:
<br>[^\:]+<br>
it will take:
<br>anything except text with ":"<br>
Posted by: maki | Date: 2017-11-01 13:27 | IP: IP Logged
pspad:Try this expression:
<br>[^\:]+<br>
it will take:
<br>anything except text with ":"<br>
Still invalid regex. Can not detect entire text.
<br><br>Ищу человека, ищу!<br><br>Рассной особе. Начнем-с?<br><br>Раз. Я дико люи \/однаю.<br><br>Два. Музы вмиг.<br><br>Три. Рисую, а если точнее, срисовываю. Плохо, правда, срисовываю, но некоторым нравится. Это что-то типа через раз получается. И обязательно с чашкой чая \\0\/<br><br>Четыре. Пишу фанфики и просто истории. Кроме того, я и ролевик тоже.<br><br>Пять. Запоями читаю книги. Или не читаю неделями, вместочто вспомнить сейчас почти что нереально. Как и сериалы. Но сейчас я зависла на сериале \"Сотня\". Иногда удивляюсь, почему у него такой низкий рейтинг?..<br><br>Шестакое счастье с:<br><br>Забыла сказать садевчонки\/мальчишки могут дать нам интересную тему для рассуждений. Так что, удачи Вам, если Вы захотели написать мне письмо.<br><br>P.S. Если у Вас есть какая-то проблема, Вы так же можете мне написать. Ведь лучше, когда выговоришься, не правда ли?<br>
Edited 1 time(s). Last edit at 2017-11-01 13:27 by maki.
Posted by: maki | Date: 2017-11-01 13:39 | IP: IP Logged
All the time there is some problem with regex, because the text contains different text
WRONG REGEX
Code:
<br>[^\:]+<br>
Text 1:
Need Correct Regex (entire text detect)
<br>TEXT<br> or </br>
Code:
<br><br>Ищу человека, ищу!<br><br>Рассной особе. Начнем-с?<br><br>Раз. Я дико люи \/однаю.<br><br>Два. Музы вмиг.<br><br>Три. Рисую, а если точнее, срисовываю. Плохо, правда, срисовываю, но некоторым нравится. Это что-то типа через раз получается. И обязательно с чашкой чая \\0\/<br><br>Четыре. Пишу фанфики и просто истории. Кроме того, я и ролевик тоже.<br><br>Пять. Запоями читаю книги. Или не читаю неделями, вместочто вспомнить сейчас почти что нереально. Как и сериалы. Но сейчас я зависла на сериале \"Сотня\". Иногда удивляюсь, почему у него такой низкий рейтинг?..<br><br>Шестакое счастье с:<br><br>Забыла сказать садевчонки\/мальчишки могут дать нам интересную тему для рассуждений. Так что, удачи Вам, если Вы захотели написать мне письмо.<br><br>P.S. Если у Вас есть какая-то проблема, Вы так же можете мне написать. Ведь лучше, когда выговоришься, не правда ли?<br>
Text2:
"post_type":"post","text":"Здравствуйте)<br>И, навтникам этой чудесной группы \/особенно к жителям Беларуси\/. Я поного внимания., как мне кажется.<br>Это моя подруга. 27 фе.<br>Мне<br>За адресом - в лс)<br><br>P.S На фото её рисунок:3"
"post_type":"post","text":T E X T"
TAG TEXT TAG
Edited 1 time(s). Last edit at 2017-11-01 13:39 by maki.
Posted by: maki | Date: 2017-11-01 13:52 | IP: IP Logged
Posted by: vbr | Date: 2017-11-01 15:26 | IP: IP Logged
Hi,
I haven't followed all posts in detail, but it seems to me, that that you hit probably two problems with regex matching in PSPad.
I think, the current regex engine in PSPad doesn't support look-around assertions like (?=...) (?!...) (?<=...) (?<!...) .
But more importantly, the search is performed linewise, ie. only within single lines - the match cannot span multiple lines, and you cannot match the line-break itself with any pattern (only the position at the beginnig or end of the line).
This can be worked around partly via scripting, but that is not straightforward.
regards,
vbr
Posted by: maki | Date: 2017-11-01 16:10 | IP: IP Logged
Regex will most likely work on all lines, as confirmed by one of the developers of another tool, but simply the problem is the characters in the text eg.
"\" or ":"
<br>[^\:]+<br>
This regex works, but only partially:
The problem still occurs with the ":" (character) and does not work with the "</b>" tag
Fit(Correct) Regex = will always work in even complex text.
It does not matter!
My regex works, but also partially, it only needs to be improved, but most of my queries here and also on other sites end up failing.
The answer must know this very good programmer, who knows well the regular expressions.
<br>text 1 bla bla : \</br>
or
<br>text 2 bla bla : \<br>
Editor PSPad - freeware editor, © 2001 - 2024 Jan Fiala, Hosted by Webhosting TOJEONO.CZ, design by WebDesign PAY & SOFT, code Petr Dvořák, Privacy policy and GDPR