Jump to content
  • 0

Suitable pattern


Splawsh

Question

Posted

Hello all 

I want a Suitable pattern for get everything (word,letters,number,symbol,emoji,Letters of other languages) from input (gg.prompt)

for using in this code ::

input = gg.prompt({"input text"},nil,{'text'})

local str = input[1]

 str = str:gsub("a Pattern for here(ex:: %S*)",  
   {['hi'] = 'Hello',
     ['a'] = '9805',
      ['s'] = '2495',
       [':('] = '',
        [''] = ':D',
         ['9999'] = 'Error',
          ['5'] = '=]'})

   gg.alert("Repaced\n"..input[1].."\nto\n"..str)
   print(str)

for example if input = ("hi as 😀 9999 5")

replacing to ("Hello 98052495 : D Error =]")

but ("%S*") is not a Suitable pattern   

 

I will be happy if you help me :))

if (a person hep me) then 
  print("Thanks U❤")
  os.exit()
end

👌😂

1 answer to this question

Recommended Posts

  • Administrators
Posted

No such pattern exists.

You need gsub in loop for each case. Escape each key as pattern, pass to gsub with replace value.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.