I want to know how to get text form a particular part of a sentence this is what i mean. Hello (new text)., in the brackets it says new text and i want to find the text in the brackets and print only the text in the brackets.
Hello (new text).
new text
With the ( and ) surrounding the text, you can use string.match:
(
)
str = "Hello (new text)" print(str:match("%((.+)%)"))
%((.+)%)") is a pattern that captures every character between the ( and ).
%((.+)%)")
Resources: Lua 5.3 Reference Manual - 6.4.1 Patterns
2.1m questions
2.1m answers
60 comments
57.0k users