What is [50-99] in regular expression?

  • Thread starter Thread starter shivajikobardan
  • Start date Start date
  • Tags Tags
    Expression Regular
AI Thread Summary
The discussion centers around the interpretation of the regular expression character set notation [50-99]. It clarifies that this notation does not represent the numeric range from 50 to 99 but rather matches individual characters between '5' and '9', which includes characters like '5', '6', '7', '8', and '9'. The confusion arises from treating the numbers as a range rather than as character representations. Participants recommend resources for learning regular expressions, highlighting regexone.com for its structured learning approach and regexpal for testing expressions. The learning process involves understanding character ranges and practicing with examples to grasp the nuances of regex syntax.
shivajikobardan
Messages
637
Reaction score
54
TL;DR Summary
regular expression character set meaning for [50-99]?
As the slide says, it's not 50-99 characters so what it is?

PDxPmiqvcz9UjWNJKyeZR2DyyMOULpLAZS0IaLfjCjF0kCR-sA.png

Source: https://www3.cs.stonybrook.edu/~pfodor/courses/CSE307/L02_Programming_RE.pdf

Also, please tell me how to learn regular expressions? Recommend some university/any courses to take for learning regular expression for backend development. (Not the one we learnt in theory of automata and computation).

There are lots of resources to learn it like regexpal for testing regular expressions, regexone.com for learning it. But how'd you learn it? Like what process do you follow to learn it?
 
Technology news on Phys.org
shivajikobardan said:
TL;DR Summary: regular expression character set meaning for [50-99]?

As the slide says, it's not 50-99 characters so what it is?
The answer is in the slide: [50-99] is the same as [0-9]. Why do you think this is?
[5] matches a 5, [9] matches a 9, [59] matches a 5 or a 9, [0-9] matches any character 0-9
shivajikobardan said:
regexone.com for learning it. But how'd you learn it? Like what process do you follow to learn it?
I had not seen https://regexone.com/ before: it looks really good so learn from that.
 
A key idea on the page about character ranges is this:
represent all characters between two characters
So 50 and 99 are not treated as numbers, but rather as a pair of characters each,
 
but I tried in regexpal, [50-99] matches number between 50-99 as well? @pbuk

edit: I'm wrong it also matches 98888
 
I got it. it's [5,0-9,9] that's why.
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...
Back
Top