YetAnotherForum
Welcome Guest Search | Active Topics | Log In | Register

what is @"\m()" means in regexp?
renshijun
#1 Posted : Tuesday, January 03, 2017 2:05:53 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 12/26/2014(UTC)
Posts: 30
Location: Harbin, China

Thanks: 1 times
Was thanked: 0 time(s) in 0 post(s)
as the topic says,no explaination in manual and lib reference.
absence
#2 Posted : Monday, January 16, 2017 10:58:50 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 8/23/2014(UTC)
Posts: 102
Man
Location: Northern Germany & Lincolnshire, U.K.

Thanks: 1 times
Was thanked: 8 time(s) in 8 post(s)
renshijun wrote:
as the topic says,no explaination in manual and lib reference.


Hmmm. Unsure.
I know this from TCL only, where \m matches beginning of a word boundary (like \< in posix). Not sure if sqstdlib supports that, never had the need. A quick glance at the stdlib sourcecode: I highly doubt it does. More likely it either wouldn't compile or exactly match the string \m itself.

note that the @ in squirrel simply starts a literal string, so the \ character is no escape but taken as is, so the expression string will exactly read \m()

Where did you get that expression?
gcgcgc
#3 Posted : Saturday, January 21, 2017 1:00:36 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/19/2011(UTC)
Posts: 9

Thanks: 0 times
Was thanked: 1 time(s) in 1 post(s)
Looking at the source, it looks like \m takes the following two characters as an argument - '(' and ')' in this case;
It then matches the shortest sequence of characters, beginning with the first character and ending with the second but with anything in between, where there is a balanced number of both characters.
ie "(xyz)" is balanced, as is "((x(y)z))" but "((x)" is not, because the first opening "(" is not matched. For "(a)(b)" only the first "(a)" would be matched etc.


absence
#4 Posted : Sunday, January 22, 2017 12:56:06 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 8/23/2014(UTC)
Posts: 102
Man
Location: Northern Germany & Lincolnshire, U.K.

Thanks: 1 times
Was thanked: 8 time(s) in 8 post(s)
Must have overlooked that, sorry. Seems like something a compiler or debugger would use to fetch expressions.
I think it should either get documented or maybe even removed from sqstdlib since it has quite some footprint for a quite specialized non-standard task. Though, I find it quite useful.
Alberto?

Users browsing this topic
Guest (3)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Clean Slate theme by Jaben Cargman (Tiny Gecko)
Powered by YAF 1.9.4 | YAF © 2003-2010, Yet Another Forum.NET
This page was generated in 0.073 seconds.