3 ms·
I've got to be honest I can read the regex example even without the comments you added in your example, I can't read the example. "Group or digit" matches 0-9?
by IanCal 5y ago
I've got to be honest I can read the regex example even without the comments you added in your example, I can't read the example.
"Group or digit" matches 0-9?
I dont think it helps that you're missing newlines. Try putting four spaces at the start of every line.
- magicmouse 5y agoOkay, i didn't know you had to put in spaces in HN comments to get it to format, here is the regular expression in classic Unix style versus Beads style for the IPv4 address (1.2.3.4): JS style: (\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]){3} Beads style: pattern octet group or digit // matches 0..9 set:'1-9' digit // matches 10 .. 99 '1' digit digit // matches 100 .. 199 '2' set:'0-4' digit // matches 200 .. 249 '25' set:'0-5' // matches 250 ..255 pattern IPv4 octet '.' octet '.' octet '.' octet As you can see the Beads pattern notation allow subroutines, uses keywords like 'digit' instead of \d, and is far more readable. There are plenty of examples, and the more complex the expression the more favorable the comparison.