PHP and MySQL Web Development - P30

PHP and MySQL Web Development - P30: PHP and MySQL Web Development teaches the reader to develop dynamic, secure, commercial Web sites. Using the same accessible, popular teaching style of the first edition, this best-selling book has been updated to reflect the rapidly changing landscape of MySQL and PHP. | 112 Chapter 4 String Manipulation and Regular Expressions Repetition Often you want to specify that there might be multiple occurrences of a particular string or class of can represent this using two special characters in your regular expression. The symbol means that the pattern can be repeated zero or more times and the symbol means that the pattern can be repeated one or more symbol should appear directly after the part of the expression that it applied to. For example alnum means at least one alphanumeric character. Subexpressions It s often useful to be able to split an expression into subexpressions so you can for example represent at least one of these strings followed by exactly one of those. You can do this using parentheses exactly the same way as you would in an arithmetic expression. For example very large matches large very large very very large and so on. Counted Subexpressions We can specify how many times something can be repeated by using a numerical expression in curly braces .You can show an exact number of repetitions 3 means exactly 3 repetitions a range of repetitions 2 4 means from 2 to 4 repetitions or an open ended range of repetitions 2 means at least two repetitions . For example very 1 3 matches very very very and very very very . Anchoring to the Beginning or End of a String You can specify if a particular subexpression should appear at the start the end or both. This is pretty useful when you want to make sure that only your search term and nothing else appears in the string. The caret symbol A is used at the start of a regular expression to show that it must appear at the beginning of a searched string and is used at the end of a regular expression to show that it must appear at the end. For example this matches bob at the start of a string Abob This matches com at the end of a string com Introduction to Regular Expressions 113 Finally this matches any single character from a to z in the string on its own A a-z

Không thể tạo bản xem trước, hãy bấm tải xuống
119    113    1    24-03-2023
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.