Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Future Improvements (https://forums.graalonline.com/forums/forumdisplay.php?f=10)
-   -   Regular Expressions (https://forums.graalonline.com/forums/showthread.php?t=134257341)

coreys 01-23-2010 06:14 AM

Not here to argue how much WoW sucks.

Loriel 01-23-2010 06:24 AM

Quote:

Originally Posted by coreys (Post 1551855)
Not here to argue how much *** sucks.

Only to argue that we need to copy its features?

coreys 01-23-2010 09:14 AM

Quote:

Originally Posted by Loriel (Post 1551857)
Only to argue that we need to copy its features?

Yes, because WoW invented this and was the first to ever, ever use it. Yes, we'll be copying WoW. Make's perfect sense. I see it now. Oh, woe is me, we'll be copying WoW. I should have known, even though I had no idea that WoW had such or feature nor would I care, nor does WoW have anything to do with it. I should have known I'd be trying to copy WoW! You, sir, have slain me!

SKJF91 01-24-2010 12:02 PM

Quote:

Originally Posted by Loriel (Post 1551857)
Only to argue that we need to copy its features?

why do you keep 'sensoring' the letters 'WoW'..

Crow 01-24-2010 12:47 PM

Quote:

Originally Posted by Loriel (Post 1551857)
Only to argue that we need to copy its features?

Blizzard didn't invent Lua's pattern system.


Quote:

Originally Posted by SKJF91 (Post 1552068)
why do you keep 'sensoring' the letters 'WoW'..

It's not allowed to discuss other MMORPGs.

DustyPorViva 02-03-2010 10:15 PM

I ran into my situation with my setguild script where I needed some basic wildcard's for filtering error chat.

For example, "You must way %d seconds to use that command again!" would have bee useful. I ended up just matching the beginning and the end of the chat anyways, however.

Immolate 02-03-2010 10:17 PM

Quote:

Originally Posted by DustyPorViva (Post 1553996)
I ran into my situation with my setguild script where I needed some basic wildcard's for filtering error chat.

For example, "You must way %d seconds to use that command again!" would have bee useful. I ended up just matching the beginning and the end of the chat anyways, however.

I'd like something like that for getstringkeys().

coreys 02-03-2010 10:58 PM

Yeah's the kind of things I wanted to be able to do.

Admins 02-09-2010 07:47 PM

Hmmm It could be interesting to add support for pcre. You basicly just want one command with a string and a regular expression as parameters and you get back a string?

cbk1994 02-09-2010 07:57 PM

Quote:

Originally Posted by Stefan (Post 1555118)
Hmmm It could be interesting to add support for pcre. You basicly just want one command with a string and a regular expression as parameters and you get back a string?

I'm not sure how it's usually used, but I would assume a function would also be needed to check a string against a regular expression. For example, ensuring that a string is only alphanumeric.

WhiteDragon 02-09-2010 09:03 PM

I imagine people would want both a

string.match(pattern) -> boolean

and a

string.replace(pattern, replacement_string) -> string

Where the replacement_string could include back-references (like $1 or $2) if pattern includes capturing parenthesis.


I still think this is a bad idea though.

coreys 02-09-2010 11:15 PM

Yeah, match and replace would be nice. And I still think that the fact that not everyone could use it is not a valid reason for not having it, that's just silly.

tempandrew 02-09-2010 11:44 PM

Quote:

Originally Posted by WhiteDragon (Post 1555129)
I imagine people would want both a

string.match(pattern) -> boolean

and a

string.replace(pattern, replacement_string) -> string

Where the replacement_string could include back-references (like $1 or $2) if pattern includes capturing parenthesis.


I still think this is a bad idea though.

This should be implemented ASAP. I can think of a lot of situations where a replace command would be great.

Loriel 02-10-2010 12:22 AM

Quote:

Originally Posted by WhiteDragon (Post 1555129)
I still think this is a bad idea though.

Matching should return or make accessible the part of the string that was actually matched (probably just offset, length) and all the parenthesised groups.

Replacing should optionally take a function instead of a string that is called with the matched part and groups and returns a replacement string.

^^

Crow 02-10-2010 12:47 AM

Quote:

Originally Posted by Loriel (Post 1555207)
Matching should return or make accessible the part of the string that was actually matched (probably just offset, length) and all the parenthesised groups.

Replacing should optionally take a function instead of a string that is called with the matched part and groups and returns a replacement string.

^^

I like the way you are thinking. I wouldn't mind having something that works just as Lua's string.gsub() does.

coreys 02-10-2010 01:00 AM

Quote:

Originally Posted by Stefan (Post 1555118)
Hmmm It could be interesting to add support for pcre. You basicly just want one command with a string and a regular expression as parameters and you get back a string?

If you do it exactly like WhiteDragon said I will love you forever and ever.

coreys 05-16-2010 10:02 PM

Three month bump.

I'm finding myself wanting this more and more :(
Even Javascript has support built into the language (it's literally in the syntax) for Regular Expressions, come on now.

MrDunne 08-21-2010 03:24 PM

Bump.

bscharff 08-21-2010 04:53 PM

Do it.

Crow 08-12-2011 06:10 PM

Bumping because I'd really like this ^^

MattKan 08-14-2011 06:09 AM

I would like this because it would allow people like Crow to make amazing things even more easily to entertain me.

Oh and people like Crow are amazing and deserve this kind of stuff.

Crow 08-14-2011 12:03 PM

Quote:

Originally Posted by MattKan (Post 1663470)
I would like this because it would allow people like Crow to make amazing things even more easily to entertain me.

Oh and people like Crow are amazing and deserve this kind of stuff.

Doh, what the..

Regular expressions are not the key to those super awesome things you'd like, but damn, they are useful.

Fulg0reSama 08-14-2011 12:06 PM

Quote:

Originally Posted by MattKan (Post 1663470)
I would like this because it would allow people like Crow to make amazing things even more easily to entertain me.

Oh and people like Crow are amazing and deserve this kind of stuff.

http://www.onmoneymaking.com/wp-cont...issing-ass.jpg

salesman 08-14-2011 08:43 PM

specific example of when this would be necessary? I cannot think of any situation where a simpler solution wouldn't work.

Crow 08-14-2011 08:51 PM

Quote:

Originally Posted by salesman (Post 1663524)
specific example of when this would be necessary? I cannot think of any situation where a simpler solution wouldn't work.

Advanced chat filters. Replacing something in a string. Other stuff.

oo_jazz_oo 08-14-2011 09:34 PM

Quote:

Originally Posted by salesman (Post 1663524)
specific example of when this would be necessary? I cannot think of any situation where a simpler solution wouldn't work.

The point isn't what they can do that other solutions can't.
The point is that they might be the better solution.

Thats how scripting languages evolve and become better. If we didn't improve on what we already have, we would still have gs1.

And in a lot of ways, regular expressions can be simpler than other solutions.
It could be the difference of writing a pretty large chunk of code, and comparing a simple regular expression.

salesman 08-14-2011 09:40 PM

I have never run into a problem where RegEx was needed on Graal and could personally care less whether or not it's added. I'm just asking the people in this thread who have "been in situations where RegEx would have useful" to support their arguments by stating what those situations were.

Bubble13 08-14-2011 09:42 PM

Quote:

Originally Posted by salesman (Post 1663544)
I have never run into a problem where RegEx was needed on Graal and could personally care less whether or not it's added. I'm just asking the people in this thread who have "been in situations where RegEx would have useful" to support their arguments by stating what those situations were.

There don't have to be any situations. It can be said that a scripting language really isn't complete without regular expressions.

cbk1994 08-15-2011 12:42 AM

Quote:

Originally Posted by Bubble13 (Post 1663545)
There don't have to be any situations. It can be said that a scripting language really isn't complete without regular expressions.

No. Changes should only be made because those changes will be useful. If there are no solutions where regular expressions would be useful, why add them to the language?

DustyPorViva 08-15-2011 12:56 AM

I've only needed this maybe... once or twice. I really wanted regular expressions those one or two times, but otherwise couldn't care less. It sounds awesome those few times you really want it, but other than that I can't see it being that useful.

Chompy 08-15-2011 05:56 PM

Making a RegEx parser isn't difficult, but it be would be more effective to have it as an in-built one if it ever was added.

RegEx could easily be used for more advanced systems dealing with a lot of information that change over time, instead of searching by wildcards for example, regex would be more effective finding specific and advanced patterns. It would also be good for e.g. fixing typos, validate input, transform parts of strings into something else and more.

"Changes should only be made because those changes will be useful." That's really productive, right... Who or what determines if changes are useful or not then?

Fulg0reSama 08-15-2011 06:11 PM

I believe Chompy just won this thread.

/thread

cbk1994 08-15-2011 10:50 PM

Quote:

Originally Posted by Chompy (Post 1663658)
"Changes should only be made because those changes will be useful." That's really productive, right...

Yes, it is productive. If you add changes that aren't useful then by definition they'll seldom be used, and the time used to add them is wasted.

I'm guessing we agree and I just wasn't very clear in making my point. You wouldn't advocate adding feature X to GScript just because language Y has it, right?

The post I was replying to said exactly that:

Quote:

Originally Posted by Bubble13 (Post 1663545)
There don't have to be any situations. It can be said that a scripting language really isn't complete without regular expressions.

In other words, "even if nobody would ever use them, they should still be added because lots of other languages support them."

Bubble13 08-16-2011 12:05 AM

Quote:

Originally Posted by cbk1994 (Post 1663692)
In other words, "even if nobody would ever use them, they should still be added because lots of other languages support them."

Sorry, I wasn't very clear. I guess I meant to say that people shouldn't have to list situations. I'm pretty sure that there would be situations that would be made easier with RegEx even if the situations weren't listed.


All times are GMT +2. The time now is 08:21 AM.

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