I need your help to extract a sentence from a web string

haydar

New member
I want to extract a sentence from a web string. I can get what I want by using <span class="description">(.*?)</span> for picture1. It is ok. But web string which you can see in picture 2, "<span class="description">(.*?)</span>" doesn't work to extract text. since "</span>" on a different line. I have tried "([?\s\S]*?) instead of (.*?), still it didint work. Plaease help me. Thanks in advaced.
 

Attachments

  • picture 1.PNG
    picture 1.PNG
    4.6 KB · Views: 14
  • picture 2.PNG
    picture 2.PNG
    3.5 KB · Views: 14

tanutanu

Well-known member
I want to extract a sentence from a web string. I can get what I want by using <span class="description">(.*?)</span> for picture1. It is ok. But web string which you can see in picture 2, "<span class="description">(.*?)</span>" doesn't work to extract text. since "</span>" on a different line. I have tried "([?\s\S]*?) instead of (.*?), still it didint work. Plaease help me. Thanks in advaced.
Try ([\s\S]+?) or ((\s|\S)+?) with group1 option instead.
 

tanutanu

Well-known member
([\s\S]+?) is worked! Thank you so much! Is there any quide where I can find how these commands works; \s, \S, +?, *? etc.?
Sounds good:)
\s matches white space, tab or CRLF/CR/LF(same as \r) .
\S is any characters excluding the above.
So, \s\S means any characters, while "." excludes \r.

Your first trial includes extra "?" in the [] class definition. Inside the brackets, it means just a "?", not means any single character(same as \? outside []). So the expression didn't match when the string didn't contain "?" character.
+ means at least 1 character(s) after a character continuously, while * includes zero length case.
The last "?" of ".*?" or ".+?" indicates matching as short as possible. It is useful when the string is expected a character follows twice or more after the expression. "<" will appear so many times. So if not added the last "?" like ".*" or ".+", the expression expand until just 1 character prior to the last "<" of the string.
 
Last edited:

haydar

New member
Thanks! I really loved macrodroid! It saves lots of money. I can do auto posting to my Telegram channels almost from any web page for free :) I have already purchased macrodroid pro.
Sounds good:)
\s matches white space, tab or CRLF/CR/LF(same as \r) .
\S is any characters excluding the above.
So, \s\S means any characters, while "." excludes \r.

Your first trial includes extra ? in the [] class definition. Inside the brackets, it means just a ?, not means any single character(same as \? outside []). So the expression didn't match when the string didn't contain ? character.
+ means at least 1 character(s) after a character continuously, while * includes zero case.
The last ? of .*? or .+? indicates marching as short as possible. It is useful when the string is expected a character follows twice or more after the exprThanks!
 

tanutanu

Well-known member
Thanks! I really loved macrodroid! It saves lots of money. I can do auto posting to my Telegram channels almost from any web page for free :) I have already purchased macrodroid pro.
Exactly. It's definitely helpful(y)
You make a bunch of your own macros without any limitations:)
 

tanutanu

Well-known member
This might help a little
Thanks, I really don't know good online manual written in English🙃
I learned reading a translated paper book when I was young:ROFLMAO:
 
Top