Solid Fluid System Solutions  
Home Software About Hardware Firmware
Folder Icon Worked Example
 
A simple example that shows how to import data into MS Excel. The demonstraton shows how regex removes the repetitive graft.

Document Icon Regex
Document Icon Characters
 
How to specify which characters should match at an arbitary position within a search text.
Current Document Icon Positioning
 
How to make matches position themselves in relation to non text entities in the search text.
Document Icon Repeat
 
How to repeat the preceeding token match.
Document Icon Groups
 
How to group tokens together for use in repetitions, references or alternatives.
Document Icon Special Groups
 
How to create metatoken, conditional and comment groups.
Document Icon Modes
 
How to control the overal mode of a regular expression.

Positioning

This page describes how to make matches position themselves in relation to non-text entities in the search text.

Although the characters in this group are used like tokens in a regular expression, none of them match an actual character in the search text. For this reason they are described as metatokens.

Character Description Example

Ways to position about the scope of the search text

\A or ^ "caret" These metatokens specify a match at the start of the search text. This is either the beginning of the file or the beginning of the selection, if one is made. The actual match occurs at the position between the first and last characters in the search text. \A. or ^. matches a in abc
\Z or $ "dollar" These metatokens specify a match at the end of the search text. This is either the end of the file or the end of the selection, if one is made. The actual match occurs at the position between the first and last characters in the search text. .\Z or .$ matches f in abc\ndef
^ "caret" The caret may also be caused to match the position between the end of a previous line, and the beginning of a current one, using the (?m) and (?-m) options described on the Modes page. ^. matches a in abc\ndef . Also matches d in (?m) mode.
$ "dollar" The dollar may also be caused to match the position between the end of a previous line, and the beginning of a current one, using the (?m) and (?-m) options described on the Modes page. .$ matches f in abc\ndef . Also matches c in (?m) mode.

Ways to position about character type changes

\b This metatoken matches a position between a word and a non-word character. .\b matches c in abc
\B This metatoken matches a position between two consecutive word, or non-word, characters. \B.\B matches b in abc

Ways to position about the previous search

\G This metatoken matches the position between the end of the previous search, and the beginning of the current one. Where there has been no previous search, this metatoken will match at the position between the beginning of the current search and the character which immediately preeceds it. \G[a-z] first matches a , then matches b and then fails to match in ab_cd .
Copyright © Solid Fluid 2007-2015
Last modified: SolFlu  Sat, 20 Jun 2009 21:02:29 GMT