You are here: PSPad forum > English discussion forum > Re: I am looking for a special pattern "Bible Verse Regex"

Re: I am looking for a special pattern "Bible Verse Regex"

Goto Page: Previous1 2 3

#21 Re: I am looking for a special pattern "Bible Verse Regex"

Posted by: vbr | Date: 2021-04-11 17:37 | IP: IP Logged

Hi,
of course, the pattern you need depends on your input data and the matches you want to get; good, that you found a pattern you are almost satisfied with or which you can tweak further.

The possible reason to use a pattern with "non-basic" Latin letters could be yout initial example with: "Kapł";

\w
won't match ł in this case, as it works in a non-unicode mode here, i.e. it matches only the following characters:
0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z _ a b c d e f g h i j k l m n o p q r s t u v w x y z

Note, that it matches basic Latin letters, an unterscore _ and also the digits 0-9, which might or might not be what you need.

regards,
vbr

Options: Reply | Quote | Up ^


#22 Re: I am looking for a special pattern "Bible Verse Regex"

Posted by: pspad | Date: 2021-04-11 17:55 | IP: IP Logged

In this case is necessary to add all non basic chars individually like: [\wł] and add all missing chars.

Options: Reply | Quote | Up ^


#23 Re: I am looking for a special pattern "Bible Verse Regex"

Posted by: Haunebu | Date: 2021-04-11 18:27 | IP: IP Logged

I do not use Latin characters, only Polish [A-Ża-ż]

Edited 1 time(s). Last edit at 2021-04-11 18:28 by Haunebu.

Options: Reply | Quote | Up ^


#24 Re: I am looking for a special pattern "Bible Verse Regex"

Posted by: Haunebu | Date: 2021-04-11 18:30 | IP: IP Logged

My pattern is wrong, for example, does not match verses in parentheses and separation in the form of a semicolon, and additional verse numbers after a spaces and a semicolon.

Example:
() ===> (any verse)
(verse ; )
(verse ;verse2 ,20, 29, 56)

Edited 4 time(s). Last edit at 2021-04-11 18:33 by Haunebu.

Options: Reply | Quote | Up ^


#25 Re: I am looking for a special pattern "Bible Verse Regex"

Posted by: therium | Date: 2021-04-30 12:42 | IP: IP Logged

Hanubu,
Your original expression is incorrect as it did not escape escapable regex characters like a dash.
Original regex: ([\d ]*[a-zA-Z]+( \d*:\d*)?)(( - )| )?(((\d* )?[a-zA-Z]+ )?\d*([:-]+\d*)?)

When searching for dashes, periods, and some other characters, they must be escaped like this: [\.\-\]

Your corrected regex:
([\d ]*[a-zA-Z]+( \d*:\d*)?)(( \- )| )?(((\d* )?[a-zA-Z]+ )?\d*([:\-]+\d*)?)

For more information on escaping characters try this search:
duckduckgo.com

To test your regex, use one of these regex testers:
duckduckgo.com

You type in your regex, then your text to search, and it will help you find something that works on the proper text. Some of these regex testers allow you to have an account so you can save your regex's. smiling smiley

Edited 1 time(s). Last edit at 2021-04-30 12:43 by therium.

Options: Reply | Quote | Up ^


Goto Page: Previous1 2 3





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