/ Published in: ASP
URL: http://reusablecode.blogspot.com/2009/05/regular-expressions.html
Expand |
Embed | Plain Text
<% ' ASP Regular Expression Library ' ' Copyright (c) 2009, reusablecode.blogspot.com; some rights reserved. ' ' This work is licensed under the Creative Commons Attribution License. To view ' a copy of this license, visit http://creativecommons.org/licenses/by/3.0/ or ' send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California ' 94305, USA. ' Case-sensitive regular expression match. function ereg(pattern, inputString) dim regEx set regEx = new RegExp with regEx .Pattern = pattern .IgnoreCase = False .Global = True end with ereg = regEx.test(inputString) set regEx = nothing end function ' Case-insensitive regular expression match. function eregi(pattern, inputString) dim regEx set regEx = new RegExp with regEx .Pattern = pattern .IgnoreCase = True .Global = True end with eregi = regEx.test(inputString) set regEx = nothing end function ' Case-sensitive regular expression replacement. function ereg_replace(pattern, replacement, inputString) dim regEx set regEx = new RegExp with regEx .Pattern = pattern .IgnoreCase = False .Global = True end with ereg_replace = regEx.replace(inputString, replacement) set regEx = nothing end function ' Case-insensitive regular expression replacement. function eregi_replace(pattern, replacement, inputString) dim regEx set regEx = new RegExp with regEx .Pattern = pattern .IgnoreCase = True .Global = True end with ereg_replace = regEx.replace(inputString, replacement) set regEx = nothing end function ' Make regular expression for case insensitive match. function sql_regcase(byVal inputString) ' Change all alphabetic characters to uppercase. inputString = ucase(inputString) ' Loop through the alphabet in ASCII. A = 65 and Z = 90. for i = 65 to 90 ' The corresponding lowercase letter of the alphabet is always 32 positions ahead of the uppercase letter. inputString = replace(inputString, Chr(i), "[" & Chr(i) & Chr(i + 32) & "]" next sql_regcase = inputString end function %>
You need to login to post a comment.
