
Security News
Another Round of TEA Protocol Spam Floods npm, But It’s Not a Worm
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.
gopkg.in/phannam1412/go-pattern-matching.v1
Advanced tools
Following are some applications for pattern matching:
input
function sayHello() {
console.log("hello \"world\"");
console.log('how \'are\' you "doing" today');
}
output
function sayHello() {
console.log(_t("hello \"world\""));
console.log(_t('how \'are\' you "doing" today'));
}
Full code
package main
import (
. "github.com/phannam1412/go-pattern-matching/parser"
"strings"
)
func main() {
input := `
function sayHello() {
console.log("hello \"world\"");
console.log('how \'are\' you "doing" today');
}
`
doubleQuote := And(
Text(`"`),
Any(Or(Text(`\"`),NotToken(`"`))),
Text(`"`),
)
singleQuote := And(
Text(`'`),
Any(Or(Text(`\'`),NotToken(`'`))),
Text(`'`),
)
formula := FullSearch(Or(doubleQuote, singleQuote), -1)
tokens := Tokenize(input)
parsed := formula(tokens, 0)
output := input
for _, v := range parsed.Children {
output = strings.ReplaceAll(output, v.Value, "_t(" + v.Value + ")")
}
println(output)
}
input
extract some url from https://example.com
or http://www.w3school.com
or with hyphen http://www.w3-school.com
output
https://example.com
http://www.w3school.com
http://www.w3-school.com
formula
domainName := And(
Alphabet,
Any(And(Hyphen, Alphabet)),
)
formula := FullSearch(And(
Or(Text("http"),Text("https")),
Text("://"),
Any(Text("www.")),
domainName,
Text("."),
Alphabet,
), -1)
input
extract some emails like contact-me-me@yahoo.com, dev.to@gmail.com,
and exclude invalid emails like ^hello@wer.co
output
contact-me-me@yahoo.com
to@gmail.com
hello@wer.co
formula
name := And(Alphabet, Any(And(Hyphen, Alphabet)))
formula := FullSearch(And(name,At,Alphabet,Dot,Alphabet,), -1)
FAQs
Unknown package
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.

Security News
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads

Research
/Security News
A malicious Chrome extension posing as an Ethereum wallet steals seed phrases by encoding them into Sui transactions, enabling full wallet takeover.