Home > Articles > Web Services > XML

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

15.3 Atoms

Each branch of an expression (or the whole expression, if it is not divided into branches) consists of a number of atoms. In the examples above, the letter 'a' is one atom and the letter 'b' is another.

Apart from individual characters, an atom can also be a character class (an escape sequence, or a selection from a predefined or user-defined group of characters) or a complete subexpression (as explained further below).

Each atom validates one portion of the value of the pattern it is being compared to, and the atoms are considered in sequential order from left to right. In the case of the pattern 'abc', the first atom, 'a', is expected to match the first character of the value. If the value does not begin with an 'a' character, then the pattern has already failed to match the value. If the value does begin with 'a', then the next atom, 'b', is compared with the next character in the value.

  • + Share This
  • 🔖 Save To Your Account