MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / regexMatch

Method regexMatch

source/core/StarString.cpp:715–723  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

713}
714
715bool String::regexMatch(String const& regex, bool full, bool caseSensitive) const {
716 re2::RE2::Options options;
717 options.set_case_sensitive(caseSensitive);
718 RE2 re(regex.utf8(), options);
719 if (!re.ok())
720 throw StringException::format("Regex pattern is invalid: {}", re.error());
721
722 return full ? RE2::FullMatch(utf8(), re) : RE2::PartialMatch(utf8(), re);
723}
724int String::compare(String const& s, CaseSensitivity cs) const {
725 if (cs == CaseSensitive)
726 return m_string.compare(s.m_string);

Callers 7

parseWarpActionFunction · 0.80
newTextValidMethod · 0.80
matchTileFunction · 0.80
relativeToMethod · 0.80
TESTFunction · 0.80
AssetsMethod · 0.80
scanAllMethod · 0.80

Calls 5

FullMatchFunction · 0.85
PartialMatchFunction · 0.85
formatFunction · 0.70
okMethod · 0.45
errorMethod · 0.45

Tested by 1

TESTFunction · 0.64