mustyoshi
|
  |
 |
| Joined: 27 Dec 2007 |
| Total Posts: 41651 |
|
|
| 20 Dec 2011 01:00 PM |
((\d+)[d](\d+))([-,+]?\d+)? That regex is best regex.
~Monica |
|
|
| Report Abuse |
|
|
Trioxide
|
  |
| Joined: 29 Mar 2011 |
| Total Posts: 32902 |
|
| |
|
|
| 20 Dec 2011 01:02 PM |
@Octoxide
Regular expression i think.
But idk wat that is.
I think some string function can use them as a string to find stoof from a string. |
|
|
| Report Abuse |
|
|
Trioxide
|
  |
| Joined: 29 Mar 2011 |
| Total Posts: 32902 |
|
| |
|
|
| 20 Dec 2011 01:03 PM |
Regedit = Registry editor, so Regex = Registry excluder
:D |
|
|
| Report Abuse |
|
|
GigsD4X
|
  |
| Joined: 06 Jun 2008 |
| Total Posts: 3794 |
|
|
| 20 Dec 2011 01:15 PM |
| EVERYBODY CALM DOWN! I KNOW REGEX. |
|
|
| Report Abuse |
|
|
mustyoshi
|
  |
 |
| Joined: 27 Dec 2007 |
| Total Posts: 41651 |
|
|
| 20 Dec 2011 01:34 PM |
What does my regex do then?
~Monica |
|
|
| Report Abuse |
|
|
|
| 20 Dec 2011 01:36 PM |
| That's the most hideous thing I've ever seen. I looks like you ate random characters, vomited them into a woodchipper, then microwaved the result. |
|
|
| Report Abuse |
|
|
mustyoshi
|
  |
 |
| Joined: 27 Dec 2007 |
| Total Posts: 41651 |
|
|
| 20 Dec 2011 01:39 PM |
@Arceus My jimmies were rustled by your post.
~Monica |
|
|
| Report Abuse |
|
|
|
| 20 Dec 2011 01:51 PM |
@Arceus Lrn2program
@OP Yeah I'd love the feature in most languages where you can do a find/replace-like operation, like PHP does: '#\[color=\#?([A-F0-9]{3}|[A-F0-9]{6})\](.*?)\[/color\]#is' To '>span style="color: #$1;">$2>/span>',
Just some example I grabbed to show people who don't understand what I'm getting at by "find/replace-like operation" :) |
|
|
| Report Abuse |
|
|
NXTBoy
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 4533 |
|
|
| 20 Dec 2011 01:56 PM |
> What does `((\d+)[d](\d+))([-,+]?\d+)?` do then?
Matches text such as:
* 123d45+345 * 98765d43 * 9d0,01 * 1d33-7
I don't understand the point in this regex. Those are very strange things to match |
|
|
| Report Abuse |
|
|
mustyoshi
|
  |
 |
| Joined: 27 Dec 2007 |
| Total Posts: 41651 |
|
|
| 20 Dec 2011 02:51 PM |
@NXT How about when you consider a simpler thing it matches? 1d20 4d6+3
(DM says you're gonna die, roll a dee six)
And herp derp, I didn't know that it matches commas, I thought commas were used to seperate different matches o_o
~Monica |
|
|
| Report Abuse |
|
|
NXTBoy
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 4533 |
|
|
| 20 Dec 2011 03:32 PM |
@mustyoshi: I figured the comma was probably a mistake.
I've never really player a game where the dice are named like that.
The regex you really want is:
(\d+)d(\d+)([-+]\d+)? |
|
|
| Report Abuse |
|
|
mustyoshi
|
  |
 |
| Joined: 27 Dec 2007 |
| Total Posts: 41651 |
|
|
| 20 Dec 2011 03:44 PM |
@NXTBoy Darn you for making my matching moar efficient. :(
~Monica |
|
|
| Report Abuse |
|
|
Varp
|
  |
| Joined: 18 Nov 2009 |
| Total Posts: 5333 |
|
|
| 20 Dec 2011 04:37 PM |
| Lua's patterns can basically do anything you can do with regex (it even supports back references)... |
|
|
| Report Abuse |
|
|
HotThoth
|
  |
 |
| Joined: 24 Aug 2010 |
| Total Posts: 1176 |
|
|
| 20 Dec 2011 06:40 PM |
| Both of them cover the same family of languages, namely Regular Languages (hence the name "regex" from "regular expression"). In FSA (finite state automata) theory, this is one of the most basic and limited classifications of languages. While still really powerful, you can't tell things like "matching number of left and right parentheses". For those of you interested in the theory behind computer science, FSA theory has some really cool proofs for things like "What kinds of questions will computers never be able to answer?" or "What kinds of questions can a computer or other machine answer with only a finite number of 'states' and without any memory?" [hint: see topic]. |
|
|
| Report Abuse |
|
|
| |
|
mustyoshi
|
  |
 |
| Joined: 27 Dec 2007 |
| Total Posts: 41651 |
|
|
| 20 Dec 2011 07:32 PM |
Jared, I'm your biggest fan!
~Monica |
|
|
| Report Abuse |
|
|
NXTBoy
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 4533 |
|
|
| 21 Dec 2011 03:47 AM |
> While still really powerful, you can't tell things like "matching number of left and right parentheses"
Actually, in lua you can - there's a "matching bracket" specifier in Lua Patterns. |
|
|
| Report Abuse |
|
|