Talk:Regular expression

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
WikiProject Computing / Software / CompSci (Rated C-class, High-importance)
WikiProject iconThis article is within the scope of WikiProject Computing, a collaborative effort to improve the coverage of computers, computing, and information technology on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
C-Class article C  This article has been rated as C-Class on the project's quality scale.
 High  This article has been rated as High-importance on the project's importance scale.
Taskforce icon
This article is supported by WikiProject Software (marked as High-importance).
Taskforce icon
This article is supported by WikiProject Computer science (marked as High-importance).
 
WikiProject Computer science (Rated C-class, High-importance)
WikiProject iconThis article is within the scope of WikiProject Computer science, a collaborative effort to improve the coverage of Computer science related articles on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
C-Class article C  This article has been rated as C-Class on the project's quality scale.
 High  This article has been rated as High-importance on the project's importance scale.
 

to complex[edit]

as a PhD in molecular biology, I know about explaining tech stuff (trust me) this article lacks a simple example at start, and lacks a sentance in intro that is clear please, add simple stuff (if the proverbial mom or dad can't get it, it ain't simple enough)

someothing like Regex refers both to a theory about how to find certain patterns, and programs that look for certain patterns. Eg, suppose we want to look for the word "serialize" and some common mispellings, and find "serialize" when it is between 1 and 20 characters from the word "journal" we would use... blah blah or something like that — Preceding unsigned comment added by 64.130.228.122 (talk) 18:06, 29 December 2017 (UTC)

poor examples[edit]

I came here to get some regex examples and these are too ambiguous https://en.wikipedia.org/wiki/Regular_expression#Formal_definition Examples:

a|b* denotes {ε, "a", "b", "bb", "bbb", …} (a|b)* denotes the set of all strings with no symbols other than "a" and "b", including the empty string: {ε, "a", "b", "aa", "ab", "ba", "bb", "aaa", …} Using short strings and not actual words isn't too comprehensible. If I was a computer examples of how to search binary numbers might be fine but these examples don't teach the concept. — Preceding unsigned comment added by Jawz101 (talkcontribs) 16:54, 2 April 2018 (UTC)

Lazy matching[edit]

However, this does not ensure that not the whole sentence is matched in some contexts. The question-mark operator does not change the meaning of the dot operator, so this still can match the quotes in the input. A pattern like ".*?" EOF will still match the whole input if this is the string

"Ganymede," he continued, "is the largest moon in the Solar System." EOF

"However, this does not ensure that not the whole sentence is matched" is either incomprehensible or very poorly phrased (double negation). In any case, ".*" EOF will match this part:

Ganymede," he continued, "is the largest moon in the Solar System.

Whereas ".*?" EOF will match the same thing (lazy/minimal/reluctant matching makes no difference here because there's only one possible match). That is to say NOT the whole input. Urhixidur (talk) 19:40, 22 January 2018 (UTC)

Bad choice of example image/regex[edit]

The example image's regex uses lookaheads/lookbehinds without them being defined anywhere in the article!

I realise this is a result of edits to the image's original caption over time, but the image should probably be removed, or definitions added. — Preceding unsigned comment added by Swith22 (talkcontribs) 22:16, 2 May 2018 (UTC)

Mistake in the regex for binary multiples of three[edit]

I tried to test the regex for binary multiples of three, but it seems to only provide either 0 or binary numbers that have a 1 at the beginning and the end. This can not be right, since e.g. 1100 is binary for 12 and does not end in a 1. — Preceding unsigned comment added by 2A02:8108:1BF:704E:58DB:9A23:AB51:9406 (talk) 22:28, 3 June 2018 (UTC)

The regular expression for binary multiples of three given is (0|(1(01*0)*1))* (note the asterisk at the end), and that certainly matches "1100": the leading "11" is matched by the 1(01*)*1 part of the alternative, and the zeroes are matched by the 0 part of the alternative, twice. – Tea2min (talk) 06:30, 4 June 2018 (UTC)