04. Anchors begins and ends with

In some cases, you'll need to specify that a string starts and/or ends with certain characters. For example, if you were reading from an ouput, and had to match if it reads "success", you couldn't just write a regex that matches "success", as "not success" and "success did not occur" would also be valid matches.

Begins and Ends with

To specify that a string should strictly start or end with certain character, we can use the hat (^) or dollar sign ($).

^zip
Match all strings that start with zip.
zip$
Match all strings that end with zip.
^z..i.p$
Match all strings that start with z, has any two characters then an i, then another character, and ends with p.

Learn how data is stored

Data Structures and Algorithms in Java

Learn how data is stored Try Data Structures

Algorithms are the procedures that software programs use to manipulate data structures. Besides clear and simple example programs, the author includes a workshop as a small demonstration program executable on a Web browser. The programs demonstrate in graphical form what data structures look like and how they operate.

$ Check price
64.9964.99Amazon 4.5 logo(97+ reviews)

More Data Structures resources

Ace your Technical Interview

Introduction to Algorithms

Ace your Technical Interview Try Algorithms

Introduction to Algorithms uniquely combines rigor and comprehensiveness. The book covers a broad range of algorithms in depth, yet makes their design and analysis accessible to all levels of readers. The algorithms are described in English and in a pseudocode designed to be readable by anyone who has done a little programming.

$ Check price
9999Amazon 4.5 logo(418+ reviews)

More Algorithms resources

Ad