Matching pattern with words and apostrophes
I'm splitting strings into individual words to create an auto-completion dictionary, but my current code does not account for words with apostrophes in them.
I'd like the dictionary to store combinations such as "doesn't", "let's", etc. I'm currently using the pattern "[%a][%w]+", which is perfectly fine for coherent words, but will cut words with apostrophes into parts. |
"[%a][%w']*[%w]+" should match a word containing an apostrophe.
|
Quote:
|
Going to keep using this thread for pattern questions.
How can I remove texture sequences from a string? How do I turn this: Lua Code:
...into this: Lua Code:
|
There might be a better funciton, but this also works:
Lua Code:
|
Quote:
|
"|T.-|t" would be better, if you use .* and you have more than one texture in the string it will match everything from the first texture to the last texture and remove the text in between.
|
Quote:
|
Quote:
|
There is also a tutorial on lua-users.org
|
http://wiki.roblox.com/index.php/String_Formatting is the best Lua pattern resource I've found.
|
Quote:
|
All times are GMT -6. The time now is 07:43 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI