How would i detect a word with a string pattern

well if the title didnt make sense, i want to make a script that detects the script source for a word WITH a string pattern like “require(%d+$)”

nothing really helped me

and if this was asked before, dont blame me i found nothing from the search bar.

anyway, not only that it would help me, it might help antiviruses on reducing false positives, too

what string are you working with and what do you want it to turn into?

post confused me a bit

Can you elaborate on what do you mean? I don’t understand this post.
Script source is only accessible to plugin scripts.

i think you didnt understand it, im working on an antivirus and im trying to reduce false positives by detecting a word with a string pattern

yeah im working on an plugin antivirus

im trying to detect a word with a string pattern at the same time

Elaborate on the “word with a string pattern” part and what did you mean by “require(%d+$)”? %d is a pattern for integers, not words.

ok, like for example theres a virus with a require


and i want to detect if it has require with numbers

because require(mainmodule) is not malicious

local id = source:match("require%((%d+)%)")

This pattern should work (if that’s what you mean). It also returns the required module ID.

Thanks, I will try it

I appreciate it

You didn’t escape the ( and ) characters properly, that’s why it doesn’t work.
This is the string pattern you are looking for that also accounts for whitespaces, variables and IDs:

Thanks too, I will try both 300000 cha rss

okay I will try that too 30 ch ars

It worked, tysm now I can finally decrease false positives

1 Like

yeah it works but not with string patterns, thanks anyway

Always printed “malicious”, thanks anyway