Skip to content

Anchors

Anchors specify a position in the string before, after, or between characters where a match must occur.

The following anchors are supported:

AnchorDescription
\m or \<Start of word
\M or \>End of word
\yWord boundary: start or end of word
\YNon-word boundary: neither start nor end of word
^Start of string
$End of string

Note: Unlike other regular expression engines, Yellowbrick does not support \b as a word-boundary anchor. Rather, Yellowbrick supports \y as a word-boundary anchor and \b as the backspace character.

Examples

premdb=> select * from team where stadium ~ '[Ll]a';
 teamid | htid | atid |       name        | nickname |    city    |     stadium     | capacity | avg_att 
--------+------+------+-------------------+----------+------------+-----------------+----------+---------
     2 |    3 |   52 | Aston Villa       | Villains | Birmingham | Villa Park      |    42785 |  33.690
    21 |   22 |   71 | Leeds United      | Whites   | Leeds      | Elland Road     |    39460 |   0.000
    34 |   35 |   84 | Sheffield United  | Blades   | Sheffield  | Bramall Lane    |    32702 |   0.000
    41 |   42 |   91 | Tottenham Hotspur | Spurs    | London     | White Hart Lane |    36284 |  35.776
(4 rows)
premdb=> select * from team where stadium ~ '\y[Ll]a';
 teamid | htid | atid |       name        | nickname |   city    |     stadium     | capacity | avg_att 
--------+------+------+-------------------+----------+-----------+-----------------+----------+---------
    34 |   35 |   84 | Sheffield United  | Blades   | Sheffield | Bramall Lane    |    32702 |   0.000
    41 |   42 |   91 | Tottenham Hotspur | Spurs    | London    | White Hart Lane |    36284 |  35.776
(2 rows)
premdb=> select * from team where stadium ~ '\Y[Ll]a';
 teamid | htid | atid |     name     | nickname |    city    |   stadium   | capacity | avg_att 
--------+------+------+--------------+----------+------------+-------------+----------+---------
     2 |    3 |   52 | Aston Villa  | Villains | Birmingham | Villa Park  |    42785 |  33.690
    21 |   22 |   71 | Leeds United | Whites   | Leeds      | Elland Road |    39460 |   0.000
(2 rows)

Parent topic:Regular Expression Details