This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function formatPattern(value, pattern) { | |
| if (value){ | |
| var characters = pattern.replace(getWildcardRegex(), ""); // removes all wild cards | |
| value = value.replace(new RegExp("["+characters+"]", 'gi'), ""); // removes all non wildcard characters in pattern | |
| if (value){ | |
| return replace(value, pattern); | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function fomatPattern(value, pattern){ | |
| if (value){ | |
| var characters = pattern.replace(/#/g, ""); | |
| value = value.replace(new RegExp("["+characters+"]", 'gi'), ""); | |
| if (value){ | |
| return replace(value, pattern); | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public bool MatchesPattern(string pattern, string text) | |
| { | |
| pattern = pattern.Replace("%", @".+"); | |
| pattern = pattern.Replace("_", @"."); | |
| Regex regex = new Regex(pattern); | |
| if (regex.IsMatch(text)) | |
| { | |
| return true; |
NewerOlder