Graal Forums  

Go Back   Graal Forums > Development Forums > Future Improvements
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-18-2009, 08:25 AM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
Regular Expressions

Every once in awhile I run across a situation where I wish I could use regular expressions in GS2. Since this is no trivial task to implement myself, not to mention it would most likely be slow if not done at a language level, it would be really nice if regular expressions were added into GS2.
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #2  
Old 12-18-2009, 01:19 PM
Programmer Programmer is offline
Coder
Programmer's Avatar
Join Date: Jan 2008
Location: -78.464422, 106.837328
Posts: 449
Programmer has a spectacular aura aboutProgrammer has a spectacular aura about
Send a message via AIM to Programmer Send a message via MSN to Programmer Send a message via Yahoo to Programmer
Quote:
Originally Posted by coreys View Post
Every once in awhile I run across a situation where I wish I could use regular expressions in GS2. Since this is no trivial task to implement myself, not to mention it would most likely be slow if not done at a language level, it would be really nice if regular expressions were added into GS2.
I completely agree. I have also come across several situations where Regex would make my life so much easier. Seeing as how several libraries offer this in C++, it should not be so difficult to implement in GScript at all.
__________________
- Iᴀɴ Zɪᴍᴍᴇʀᴍᴀɴ
Reply With Quote
  #3  
Old 12-18-2009, 01:21 PM
Immolate Immolate is offline
Indigo
Join Date: Dec 2009
Posts: 322
Immolate is on a distinguished road
Yeah, I support this.
Reply With Quote
  #4  
Old 12-23-2009, 09:02 PM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
Bump!
There's a couple things I hope to use regex for that would make my life so much better.
Better living through regular expressions!
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #5  
Old 12-23-2009, 09:36 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Could you show some theory usage of how it would work? I haven't touched regex before.
__________________
Quote:
Reply With Quote
  #6  
Old 12-23-2009, 09:44 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Lua syntax, it's from one of my WoW addons:
PHP Code:
msg gsub(msg"^|Hchannel:(%S+)|h%[([%d%.%s]*)([^%]]+)%]|h ""|Hchannel:%1|h" .. channelFormat .. "|h "); 
Basically, this replaces the display format of the channel escape sequence (WoW stuff) at the start of the string msg (if any escape sequence exists) with a predefined new format stored in channelFormat.
WoW channel escape sequences work like this:
PHP Code:
|Hchannel:CHANNEL_HERE|hCHANNEL_DISPLAY_NAME_HERE|
If you want to know some more details, either ask, or check out patterns on the Lua website. Also, as far as I know, Lua implements regular expressions a tad differently compared to other languages, so you might also want to check out the PHP documentation.
__________________
Reply With Quote
  #7  
Old 12-23-2009, 09:44 PM
WhiteDragon WhiteDragon is offline
Banned
Join Date: Feb 2007
Posts: 1,002
WhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to behold
I've never needed regex for coding anything in Graal. Not to mention they can lead to some seriously inefficient code if you don't know what you are doing (e.g., when checking against a non-regular language, unlimited backreferences are an NP-complete problem).
Reply With Quote
  #8  
Old 12-23-2009, 09:50 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
I've ran into a couple situations where I really wish I had it. I think getstringkeys() is probably the most common.
Reply With Quote
  #9  
Old 12-23-2009, 09:54 PM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
I'm familiar with regular expressions as they're used in Python. They're a tad bit complicated to learn, but very useful for searching for patterns.

And inefficient code is always an issue, no matter what you do, so it's not really a reason to not support this. I personally could find good use for regex.
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #10  
Old 12-23-2009, 10:12 PM
WhiteDragon WhiteDragon is offline
Banned
Join Date: Feb 2007
Posts: 1,002
WhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to behold
Quote:
Originally Posted by coreys View Post
And inefficient code is always an issue, no matter what you do, so it's not really a reason to not support this. I personally could find good use for regex.
I'm just saying that regex is particularly complex and therefore more prone to inefficiencies.
Reply With Quote
  #11  
Old 12-23-2009, 10:44 PM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
Quote:
Originally Posted by WhiteDragon View Post
I'm just saying that regex is particularly complex and therefore more prone to inefficiencies.
Yeah, but user error is user error, no reason not to have it
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #12  
Old 12-24-2009, 12:12 AM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
Pft, who needs regexps when you could instead build some awesome parser combinator system.
Reply With Quote
  #13  
Old 12-24-2009, 12:28 AM
WhiteDragon WhiteDragon is offline
Banned
Join Date: Feb 2007
Posts: 1,002
WhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to behold
Quote:
Originally Posted by Loriel View Post
Pft, who needs regexps when you could instead build some awesome parser combinator system.
Whoever implements parsec first wins a cookie!

Last edited by WhiteDragon; 12-24-2009 at 12:45 AM..
Reply With Quote
  #14  
Old 01-15-2010, 11:07 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Bumping this because I just ran into a place where this would be perfect.
__________________
Reply With Quote
  #15  
Old 01-16-2010, 12:00 AM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
Quote:
Originally Posted by Loriel View Post
Pft, who needs regexps when you could instead build some awesome parser combinator system.
Bumping this too!!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 03:29 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.