File tree Expand file tree Collapse file tree 1 file changed +25
-23
lines changed
Expand file tree Collapse file tree 1 file changed +25
-23
lines changed Original file line number Diff line number Diff line change @@ -17,28 +17,30 @@ Initial preview release
1717### Example
1818----
1919
20- $flux = new Flux();
21- $subject = 'http://selvinortiz.com';
22-
23- $flux
24- ->startOfLine()
25- ->find('http')
26- ->maybe('s')
27- ->then('://')
28- ->maybe('www.')
29- ->anythingBut('.')
30- ->raw('.com|.co')
31- ->inAnyCase()
32- ->endOfLine();
33-
34- // Echoing the instance will yield the compiled pattern (__toString)
35- echo $flux; // /^(http)(s)?(\:\/\/)(www\.)?([^\.]*)(.com|.co)$/i
36-
37- // Match against the subject string
38- echo $flux->match( $subject ); // TRUE
39-
40- // Replace the subject with matched segment $5 and $6
41- echo $flux->replace( '$5$6', $subject ); // selvinortiz.com
20+ ``` php
21+ $flux = new Flux();
22+ $subject = 'http://selvinortiz.com';
23+
24+ $flux
25+ ->startOfLine()
26+ ->find('http')
27+ ->maybe('s')
28+ ->then('://')
29+ ->maybe('www.')
30+ ->anythingBut('.')
31+ ->raw('.com|.co')
32+ ->inAnyCase()
33+ ->endOfLine();
34+
35+ // Echoing the instance will yield the compiled pattern (__toString)
36+ echo $flux; // /^(http)(s)?(\:\/\/)(www\.)?([^\.]*)(.com|.co)$/i
37+
38+ // Match against the subject string
39+ echo $flux->match( $subject ); // TRUE
40+
41+ // Replace the subject with matched segment $5 and $6
42+ echo $flux->replace( '$5$6', $subject ); // selvinortiz.com
43+ ```
4244
4345### FLUX API
4446The ** flux** API was designed to give you a * fluent chainable object to build patterns with* .
@@ -69,4 +71,4 @@ Alias to `any()`
6971#### ` replace( $replacement, $subject ) `
7072
7173#### ` (...) `
72- The are plenty of other function to document but I'll get to the rest shortly
74+ There are plenty of other function to document but I'll get to the rest shortly
You can’t perform that action at this time.
0 commit comments