Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  This topic is locked: you cannot edit posts or make replies.     Home » Forums » CMUD General Discussion Goto page Previous  1, 2
chamenas Posted: Thu Mar 27, 2008 12:20 am
Storing a %1 variable
JQuilici
Adept


Joined: 21 Sep 2005
Posts: 250
Location: Austin, TX

PostPosted: Thu Mar 27, 2008 2:27 pm   
 
Brackets and parens are NOT the same, inside a regex.

[abc] will match a single character - any one of 'a', 'b', or 'c'.

(abc) will match the three-character string 'abc', and create a numbered backreference.

(?:abc) will match the three-character string 'abc', and NOT create a numbered backreference.

(?P<foo>abc) will match the three-character string 'abc', and create a NAMED backreference (named 'foo')

{abc} will...uh...I think match the five-character string '{abc}'. I don't think that curly braces are special chars in a regex. I may be wrong about that.

The rules are different for a zScript pattern, of course. Wink
_________________
Come visit Mozart Mud...and tell an imm that Aerith sent you!

Last edited by JQuilici on Thu Mar 27, 2008 11:40 pm; edited 1 time in total
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Thu Mar 27, 2008 2:39 pm   
 
What? Perhaps this is a cultural thing, but () are called brackets. Parenthesis also means (). So where's the confusion? When people mean [] or <> they normally say square or triangular brackets. We're aware that all the different kinds of brackets do different things; I mean that the word "brackets" means the same thing as "paranthesis". My Year 7 english teacher would agree, I'm sure.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Thu Mar 27, 2008 4:10 pm   
 
I don't say square brackets, just brackets. :P
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Thu Mar 27, 2008 5:30 pm   
 
I think it's a cultural thing. In the U.S., "brackets" are always [] or <> and "parenthesis" are always (). I've never heard of anyone calling () "brackets" before, so I think it's a US/UK difference.
Reply with quote
Guinn
Wizard


Joined: 03 Mar 2001
Posts: 1127
Location: London

PostPosted: Thu Mar 27, 2008 6:42 pm   
 
And a congrats(?) to Chamenas for passing 100 posts in their first day Laughing
_________________
CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;)
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Thu Mar 27, 2008 6:45 pm   
 
Lots of questions Embarassed
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Thu Mar 27, 2008 8:21 pm   
 
Zugg wrote:
I think it's a cultural thing. In the U.S., "brackets" are always [] or <> and "parenthesis" are always (). I've never heard of anyone calling () "brackets" before, so I think it's a US/UK difference.

Weird. The [] <> {} are never used in normal writing - they're only used in maths and computers and for other special notations. So you really go to all the effort, in general conversation, of calling () parenthesis? Seems a bit long-winded to me.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: Thu Mar 27, 2008 8:32 pm   
 
For me
{} are braces or curly brackets
[] are square brackets or just brackets
<> angular brackets
() parenthesis
Oh and I'm a Canuck
_________________
-Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style."
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Thu Mar 27, 2008 9:49 pm   
 
Fang Xianfu wrote:
So you really go to all the effort, in general conversation, of calling () parenthesis? Seems a bit long-winded to me.

I've heard and used parens or prens for short in conversation.
In writing I usually spell it out of simply type them ().
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
JQuilici
Adept


Joined: 21 Sep 2005
Posts: 250
Location: Austin, TX

PostPosted: Thu Mar 27, 2008 11:29 pm   
 
Yep. Here in the great state of Texas (in the USA), we've always called:

() parens (when speaking) or parentheses (when writing)
[] brackets (or sometimes square brackets)
<> carets (or sometimes angle brackets or angle braces)
{} braces (or curly braces)

...so it's a cultural thing.

And the only reason I made an issue of it is that our original poster still seemed to be unclear on the difference between (a|the) (which I call parens) and [a|the] (which I call brackets) inside a regex:
chamenas wrote:
Every time I use a bracket, someone says I should use parentheses.

Say I want to say it could be a or the, on the site I'm fairly certain it says [a|the]

The cultural confusion is partly to blame here. However, to be specific, the pattern in the quote, using square brackets, will match ONE character - any one of 'a', '|', 't', 'h', or 'e' - which is not what he was trying to achieve. The pattern '(a|the)', on the other hand, will match either the word 'a' or the word 'the', which IS what he wants.

</deadhorse>
_________________
Come visit Mozart Mud...and tell an imm that Aerith sent you!
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5187

PostPosted: Thu Mar 27, 2008 11:42 pm   
 
Since this topic has degenerated to the naming of the clase of symbols I will be locking it, and I shall have the last word.

Now for those that need a true English lesson, no one in particular here. Brackets is the name for a class of symbols encompassing [](){}<>. Each grouping also has a name for the group which has already been expounded upon in previous posts. If you want someone to know exaclty what you mean then you should refer to the symbol by its direct name, such as open parenthesis, less than, and close brace.

For those that are symbol name impaired here are a few more:
! exclamation point
@ at
# pound or number sign
$ dollar sign
% percent
^ circumflex or caret
& ampersand
* asterisk
_ underscore
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Display posts from previous:   
Post new topic   This topic is locked: you cannot edit posts or make replies.     Home » Forums » CMUD General Discussion All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net