Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-57440

Regex for TOC macro work differently between in preview and in page itself

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Low
    • None
    • 6.12.0
    • None

    Description

      Summary

      Regex for TOC macro works differently between in the preview and in the page itself.

      Steps to Reproduce

      1. Open a page in edit mode
      2. Insert headings which have the names below
        • ABC
        • BCD
      3. Insert Table of Contents Macro in the page
      4. Open a configuration dialog of the macro
      5. Set Include Headings option with using a regex B.+
      6. Hit Preview button
      7. Hip Save button

      Expected Results

      The preview and the page itself shows same headings with the macro.

      Actual Results

      The preview and the page itself shows different results. These behaviors are quite unintuitive for users.

      The preview shows only the heading "BCD".

      The page itself shows both "ABC" and "BCD".

      Notes

      From my investigation, the regex of Include Headings works as follows.

      In preview:

      Confluence uses the regex to match substring of each heading

      In page itself:

      Confluence uses the regex to match head of each heading

      It means, if we would like to match only "BCD" in the page itself, we need to use ^B.+ or ^B instead.

      Workaround

      Please try to use regex to match head of each heading.

      Attachments

        1. screenshot-1.png
          screenshot-1.png
          166 kB
        2. screenshot-2.png
          screenshot-2.png
          51 kB

        Issue Links

          Activity

            People

              Unassigned Unassigned
              yokamoto Yuki Okamoto (Inactive)
              Votes:
              6 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated: