View Single Post
Old 12-31-2016, 02:23 PM   #36
CalibUser
Addict
CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.
 
Posts: 201
Karma: 62362
Join Date: Jul 2015
Device: Sony
Hi,
Although I have not had time to proof read the guide, I thought I ought to report what I think is an error in the section "Advanced Find & Replace – Regex".

The following find expression is given in the text:

<p>\sCHAPTER\s(\d+)\s</p>

and is explained correctly as follows:

  • <p> – Look for a starting paragraph tag.
  • \s – Regex code to match any white space (blanks, tabs, etc.).
  • CHAPTER – Match the word CHAPTER (Regex is case-sensitive by default).
  • \s – Regex code to match any white space.
  • (\d+) – Regex code to match any number of digits in a row and remember them.
  • \s – Regex code to match any white space.
  • </p> – Look for an end paragraph tag.

However, the regular expression \s requires that one white space is present in the appropriate places, so the application of this expression to the following examples given in the guide will not work:

<p>CHAPTER 7</p>

and

<p> CHAPTER 14</p>

[For some reason only one space shows when this is put on the forum page although I tried to insert several spaces in front of CHAPTER and several spaces after CHAPTER to match the example in the guide]

The correct expression to find the text in this example should be:

<p>\s*CHAPTER\s*(\d+)\s*</p>

This is similar to the one given in the guide except I have placed an asterisk after the \s. The explanation of this updated expression is:
  • <p> – Look for a starting paragraph tag.
  • \s – Regex code to match none, one or more white spaces (blanks, tabs, etc.).
  • CHAPTER – Match the word CHAPTER (Regex is case-sensitive by default).
  • \s – Regex code to match any white space.
  • (\d+) – Regex code to match any number of digits in a row and remember them.
  • \s – Regex code to match none, one or more white spaces
  • </p> – Look for an end paragraph tag.

Perhaps it may be useful to capture a list of errors (if there are any more) in this thread to help when the guide is updated?
CalibUser is offline   Reply With Quote