Cara menggunakan mysql regexp space
❮ PHP String Reference ExampleWrap a string into new lines when it reaches a specific length: $str = "An example of a long word is: Supercalifragulistic"; Definition and UsageThe wordwrap() function wraps a string into new lines when it reaches a specific length. Note: This function may leave white spaces at the beginning of a line. Syntaxwordwrap(string,width,break,cut) Parameter ValuesParameterDescriptionstringRequired. Specifies the string to break up into lineswidthOptional. Specifies the maximum line width. Default is 75breakOptional. Specifies the characters to use as break. Default is "\n"cutOptional. Specifies whether words longer than the specified width should be wrapped:
Technical DetailsReturn Value:Returns the string broken into lines on success, or FALSE on failure.PHP Version:4.0.2+Changelog:The cut parameter was added in PHP 4.0.3More ExamplesExampleUsing all parameters: $str = "An example of a long word is: Supercalifragulistic"; ExampleWrap a string into new lines: $str = "An example of a long word is: Supercalifragulistic"; The HTML output of the code above will be (View Source):
The browser output of the code above will be: An example of a long word is: Supercalifragulistic Try it Yourself »❮ PHP String Reference MySQL REGEXP performs a pattern match of a string expression against a pattern. The pattern is supplied as an argument. If the pattern finds a match in the expression, the function returns 1, else it returns 0. If either expression or pattern is NULL, the function returns NULL. Syntax: expr REGEXP pat Argument NameDescriptionexprA string expression.patA pattern whose match is to be found in the expression. Note: As MySQL uses the C escape syntax in strings (for example, “\n” to represent the newline character), you must double any “\” that you use in your REGEXP strings. REGEXP is not case sensitive, except when used with binary strings. MySQL Version: 5.6 Video Presentation Your browser does not support HTML5 video. Example of MySQL REGEXP operator using(^) find from beginning The following MySQL statement will find the author’s name beginning with ‘w’. The ‘^’ is used to match the beginning of the name. Code:
Sample table: author Sample Output: mysql> SELECT * FROM author -> WHERE aut_name REGEXP '^w'; +--------+-----------------+---------+-----------+ | aut_id | aut_name | country | home_city | +--------+-----------------+---------+-----------+ | AUT001 | William Norton | UK | Cambridge | | AUT002 | William Maugham | Canada | Toronto | | AUT003 | William Anthony | UK | Leeds | +--------+-----------------+---------+-----------+ 3 rows in set (0.13 sec) PHP script
View the example of REGEXP operator using(^) find from beginning in browser JSP script
Example of MySQL REGEXP operator using (^) with binary operator The following statement will find the author’s name containing exactly 12 characters. Use ‘^’ and ‘$’ match the beginning and ending of the name and ‘{12}’ have been after ‘.’ for repeating ‘.’ twelve times. |