Why does Textpad ask if you want to use POSIX regex syntax?

I need to extract a bunch of image URLs from a document in which images are associated with these names:

bellpepper = "http://images.com/bellpepper.jpg"
cabbage = "http://images.com/cabbage.jpg"
lettuce = "http://images.com/lettuce.jpg"
pumpkin = "http://images.com/pumpkin.jpg"

I want to remove all text except the URLs from the file by deleting the variable name, equal sign and double quotes, so I have a new file, which is a list of URLs, one per line.

I tried various ways to identify non-URL data using regular expressions in Textpad by checking the "Regular Expression" checkbox in the Find dialog box, but the Text Panel doesn't seem to like any of them.

In <

Configure->Preferences->Editor

there is an option:

"Use POSIX regular expression syntax"

Unlike what?

, Textpad?

+3
3

POSIX TextPad. /:

TextPad POSIX P1003.2, POSIX UNIX ( ).

TextPad, :

Find in: ^[^"]*"\([^"]*\)"
Replace with: \1

:

:

^ - start of line
[^"]* - in a set the caret ^ is for negation, 
        so a greedy match of anything that is not a "
        in this case, everything up to the first quote
" - the first quote per line in your source text
\(...\) - puts together a group that can be referenced later
[^"]* - same explanation as above, this time matching the url in question
" - the last quote on the line

, Regex TextPad, , "Default" "POSIX". , -, Grouping () {} Default POSIX.

, TextPad " POSIX", "Find in" :

Find in: ^[^"]*"([^"]*)"
+4

POSIX Perl .

+3

The original basic regular expressions, for example, which can be found on "sed", have some differences from what we most often use. For example, you use \(and \)to designate groups instead of (and), but there is no modifier "+".

In addition, I note a related question that your "*" is outside the bracket, not inside. This means that only one char will be matched to the first group.

+2
source

Source: https://habr.com/ru/post/1712865/


All Articles