Some may know, but I’m currently making a String rewriting Function. I’ve got the majority of it completed, yet there’s one piece missing, I’m trying to figure out how to fish out a specific sentence; for this example a word. it’ll work perfectly unless someone adds another Character whichever defined word, much like bypassing the ROBLOX Chat Filter. Is there a possible way to identify whether or not the User has used the word with other Characters applied to it?

Current function:

String = "Hello, there!"
local reString = {}
function rewrite(String)
   if (String:match("[%w%p]+")) then
     for a in String:gmatch("[^%s]+") do
       if (a ~= String:find("Hello") then --// Example to justify my point
          table.insert(reString,a)
         end
      end 
      else return "empty"
   end
  return table.concat(reString, " ")
end
restring = rewrite(String)
print(restring)  --// -> ", there!" is what I’m looking for

Thanks!

4 comments

2

Can you include some sample of input and expected output strings.

0

I have, it’s already in the question’s Lua piece. I want it to cut out the specified word from the string, regardless if it’s conjoined with more characters

0

Hello there would obviously work, -> there, but with more characters is like this to happen -> , there

0

im judging it