ApSIC Xbench Forum

Inconsistent spaces around tags

#1

Is it possible to check inconsistent spacing around tags?
Does’t anyone have any checklists that help at all they can share?

Chris

0 Likes

#2

Hi Chris,

You can check inconsistent spacing around tags with the following searches:

  1. Inconsistent spacing before tags:
    Source: "([:space:]+\<[^\>]+\>)=1"
    Target: -@1
    Search mode: Regular Expressions
    PowerSearch: On. (Press Ctrl+P)

  2. Inconsistent spacing after tags:
    Source: "(\<[^\>]+\>[:space:]+)=1"
    Target: -@1
    Search mode: Regular Expressions
    PowerSearch: On. (Press Ctrl+P)

Best regards,
Oscar.

0 Likes

#3

Thanks for the help. However, now I see this won’t work as the spacing we have been having issues with are link tags but in a segment there would be a space and no space around a tag so we will get FPs for every segment with tags

0 Likes

#4

Could it be controlled just for the

a href and /a
tags?

0 Likes

#5

The following search would check if the target matches the number of spaces before or after the tag:

Source: "(\</a\>[:space:]+)=1" OR "([:space:]+\</a\>)=2"
Target: -@1 OR @2
Search mode: Regular Expressions
PowerSearch: On.

The following search would apply to check the <a href tag:
Source: "\<a href" ("(\<a href[^\>]+\>[:space:]+)=1" OR "([:space:]+\<a href[^\>]+\>)=2")
Target: -@1 OR @2
Search mode: Regular Expressions
PowerSearch: On.

If checking the number of spaces is not required, replace [:space:]+ with [:space:].

0 Likes

#6

It is still showing FP

0 Likes

#7

Could you please contact support to submit a bug so that we can further investigate this issue?
Please attach a sample file containing strings that are displayed as false positives.

0 Likes

#8

Hi Chris,

Probably a bit too late for your issue, but the thing is, the main reasons why I conceive this inconsistent spacing might be an actual issue are:

  1. The presence of double spaces (e.g.: one before and another after a tag).
  2. The absence of a space before and after a tag (resulting in two words stuck together).

In both cases, both issues can (or, better said, should) be detected if you check the Ignore Tags checkbox in QA window. This way, double spaces should be detected by Xbench and the absence of the prescriptive space should be spotted by spellchecker (IMHO, in most cases no correctly spelled word will result from two random words stuck together).

Actually, perhaps it’s because of the checks I usually run, but I honestly think the Ignore Tags checkbox should be checked by default (Tag mismatch issue will still be detected with that checkbox activated, so I believe there are very few reasons to leave it unchecked).

The other reason one might want to check an inconsistent spacing is that the anchor tag pair changes formatting in final file (basically, through underlining or font change), and having an underlined space would look bad.

If that’s the case, I guess your problem is not so much having inconsistent spacing, but rather having spaces immediately after the first tag and/or immediately before the second tag of the tag pair (i.e.: something like “Some text <1st tag> blablah <2nd tag> some more text”).

If that’s the case, and assuming your problem is only with “a href” tag pairs, I would change the approach of the check and suggest the following:

Target: \<a href[^\>]+\>[:space:]|[:space:]\</a\>
Search mode: Regular Expressions
Ignore Tags: OFF

This way, you should find all strings with a space after the opening anchor tag and/or with a space before the closing anchor tag.

If, for whatever reason, you still want the Ignore Tags checkbox unchecked and want to check also the absence of spaces around such tags, you can perform the following check:

Target: \<a href[^\>]+\>[:space:]|[:space:]\</a\>|[:alpha:]\<a href[^\>]+\>[:alpha:]|[:alpha:]\</a\>[:alpha:]
Search mode: Regular Expressions
Ignore Tags: OFF

Hope it helped!

Kind regards,

Manuel

0 Likes

#9

Thanks Manuel, that is an interesting approach thanks. I caught a missing space in the spell checker straight away.

0 Likes