tailieunhanh - ColdFusion Developer’s Guide phần 2
Trừ khi được cho phép bất kỳ giấy phép đó, không có phần hướng dẫn này có thể được sao chép, lưu trữ trong một hệ thống thu hồi, hoặc truyền, ở dưới bất kỳ hình thức nào hoặc bất kỳ phương tiện, cơ khí, điện tử, ghi âm, hay nói cách khác, mà không có sự cho phép trước bằng văn bản của . | ADOBE COLDFUSION 8 108 ColdFusion Developer s Guide By default the matching of regular expressions is case-sensitive. You can use the case-insensitive functions REFindNoCase and REReplaceNoCase for case-insensitive matching. Because you often process large amounts of dynamic textual data regular expressions are invaluable in writing complex ColdFusion applications. Using ColdFusion regular expression functions ColdFusion supplies four functions that work with regular expressions REFind REFindNoCase REReplace REReplaceNoCase REFind and REFindNoCase use a regular expression to search a string for a pattern and return the string index where it finds the pattern. For example the following function returns the index of the first instance of the string BIG cfset IndexOfOccurrence REFind BIG Some BIG BIG string -- The value of IndexOfOccurrence is 5 ------- To find the next occurrence of the string BIG you must call the REFind function a second time. For an example of iterating over a search string to find all occurrences of the regular expression see Returning matched subexpressions on page 117. REReplace and REReplaceNoCase use regular expressions to search through a string and replace the string pattern that matches the regular expression with another string. You can use these functions to replace the first match or to replace all matches. For detailed descriptions of the ColdFusion functions that use regular expressions see the CFML Reference. Basic regular expression syntax The simplest regular expression contains only a literal characters. The literal characters must match exactly the text being searched. For example you can use the regular expression function REFind to find the string pattern BIG just as you can with the Find function cfset IndexOfOccurrence REFind BIG Some BIG string --- The value of IndexOfOccurrence is 5 --- In this example REFind must match the exact string pattern BIG . To use the full power of regular expressions combine literal characters .
đang nạp các trang xem trước