[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: How to match last word in quotes in a sentence in Lua
- From: "Peter Loveday" <peter@...>
- Date: Mon, 14 Oct 2013 20:12:53 +1030
I’m sure there are many solutions.. but maybe something like:
sentence:match("\"([a-zA-Z0-9 ]+)\"[^\"]+$")
(match a quoted string, but anchored to the end and with no other quotes
after it)
- Peter
From: Igor
Sent: Monday, October 14, 2013 7:52 PM
To: lua-l@lists.lua.org
Subject: How to match last word in quotes in a sentence in Lua
How to match last quoted word in a sentence (or first in quotes from end)
and print it without quotes?
Example: I "need" a help with "regular" expressions.
Output: regular
I used this example: sentence = I "need" a help with "regular" expressions.
quoted = sentence:match("\"[a-zA-Z0-9 ]+\""), but it matches both quoted
words.
Thanks
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2013.0.3408 / Virus Database: 3222/6747 - Release Date: 10/13/13