[xsl] A regular expression for the content of any processing-instruction

Subject: [xsl] A regular expression for the content of any processing-instruction
From: "Costello, Roger L." <costello@xxxxxxxxx>
Date: Thu, 23 Feb 2012 13:43:21 +0000
Hi Folks,

I created a regex for the content of any PI.

Is my regex correct?

Here is the structure of the content of any PI:

1. Zero or more whitespace characters. This is expressed as: \s*

2. One or more XML name characters. This is expressed as: \c+

3. Zero or more whitespace characters. This is expressed as: \s*

4. The equals sign. This is expressed as: =

5. Zero or more whitespace characters. This is expressed as: \s*

6. Either a single- or double-quote character. This is expressed as: ["']

7. One or more characters (any kind of character). This is expressed as: .+

   Note: the period allows any character. That's not correct. What is
correct?

8. Either a single- or double-quote character. This is expressed as: ["']

9. Repeat (1) - (8) one or more times. This is expressed as: ( ... )+

10. Zero or more whitespace characters. This is expressed as: \s*

Here is the resulting regex:

(\s*\c+\s*=\s*["'].+["'])+\s*

Do you agree?

/Roger

Current Thread