Suppose you have a text document, and you want to tag portions of it. This is a format for doing that.
The format is made of the following:
- Points - A single place in some text.
- Ranges - A contiguous stream of text with a defined start and end.
- Selections - A list of Ranges.
A Point is a single place in the text in between characters. The format is like this:
[p<paragraph_num>][{<string>}[<match_num>]][e]
Paragraphs breaks are two or more sequential lines of whitespace. Leading and trailing whitespace in the document is discarded.
A range is two points separated by _
. The second point will be relative to the first point if no paragraph is included.
A Selection is one or more Ranges separated by ,
. A single Range is also a Selection.
Here's a sample text and table of examples.
I am a sample text. I am a very simple piece of text for sample purposes.
Don't think of me as something more than just a sample.
I'm not one of those "meaningful" bits of text.
The *
in the Example indicates where the Point refers to
Point | Meaning | Example |
---|---|---|
p0 |
Start of the first paragraph | "* I am a sample text..." |
p1 |
Start of the second paragraph | "* Don't think of me..." |
p0{am} |
Start of first string "am" in first paragraph | "I * am a sample text..." |
p0{am}1 |
Start of second string "am" in first paragraph | "I am a sample text. I * am a very simple..." |
p0{am}e |
End of first string "am" in first paragraph | "I am* a sample text..." |
p0{am}1e |
End of second string "am" in first paragraph | "I am a sample text. I am* a very simple..." |
{am} |
First occurrence of string "am" in whole document | "I * am a sample text..." |
p0e |
End of first paragraph | "...for sample purposes.* " |
Range | Meaning | Value |
---|---|---|
p0_p0e |
The whole first paragraph | "I am a sample text. I am a very simple piece of text for sample purposes." |
p0_{text.}e |
From the start up to and including "text." | "I am a sample text." |
{sample}_{of}e |
From "sample" through "of" | "sample text. I am a very simple piece of" |
{sample}_{of} |
From "sample" up to "of" | "sample text. I am a very simple piece " |
{sample}1_{of}e |
From the second "sample" through the next "of" | "sample purposes. Don't think of" |
Selection | Value |
---|---|
p2_{not}e,p2{bits}_{text.}e |
"I'm not", "bits of text" |