Jump to content
walt.farrell

Regular Expression Anomaly #1: ^ character

Recommended Posts

Experimenting with regular expression Find/Replace, I discovered an anomaly using the ^ character, which should match the beginning of a line.

I started with this text:

image.png.671f42b75108bd830dc55661dd06fd8a.png

and did a search for a very simple regular expression: just the ^ character and nothing else.

From my previous regex experience, this should match:

  1. Before the first paragraph break
  2. Before O in Off
  3. Before R in Riding
  4. Before i in into

Instead, based on the resulting cursor position in each case, it matched:

  1. Before the first paragraph break
  2. Again, before the first paragraph break
  3. Before the second paragraph break
  4. Before the line break
  5. Before the last paragraph break (but in the find results, it was after the last paragraph break)

find-caret.png.306bbc34fb8b2352f43ead5cf850c986.png

 

 

find-caret.afpub

image.png


-- Walt

Windows 10 Home, version 1903 (18362.356), 16GB memory, Intel Core i7-6700K @ 4.00Gz, GeForce GTX 970
Affinity Photo 1.7.3.481 and 1.8.0.486 Beta   / Affinity Designer 1.7.3.481 and 1.8.0.486 Beta  / Affinity Publisher 1.7.3.481 and 1.7.3.475 Beta

Share this post


Link to post
Share on other sites

Hi Walt,

Apologies for the delay in our response!

This seems to be alright for me in 1.7.2, unless my expectations are wrong?

I've attached a replace a did on the occurrences it found.

image.png


Serif Europe Ltd. - www.serif.com

Share this post


Link to post
Share on other sites

The insertion point is indeed in the correct place (which can be noticed if you just click Find and subsequently type in a character), but it is displayed as if it were at the end of the line (and before the break symbol). One might expect to see it blinking in the beginning of the line (?).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

These are the Terms of Use you will be asked to agree to if you join the forum. | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.