Dreamweaver regex followed by number

I use Dreamweaver to update copyright dates on my site. I want to keep existing intervals (or lack thereof) between years. Examples: & Copy; 2002-2008 should be updated and copied; 2002-2009 & Copy; 2003 - 2008 It should be updated and copied; 2003 - 2009 This is a regular expression that I use to do this in the search and replace function of Dreamweaver Find: & Copy; \ S * (\ d {4} \ S * - \ S *) \ d {3} [^ 9]

Replace: & Copy; $ 1 2009

Here's the PROBLEM: This expression works, but has this extra space between hyphens and 2009. If I write the replace expression without a space, as & copy; $ 12009, then dreamweaver searches for the 12.009th replacement in the find expression and, not finding it, prints $ 12009.

+3
source share
2 answers

If you didn’t capture - like the spaces before or after it, but only capture the leading year, then this will make life easier: © \ S * (\ d {4}) \ S * - * \ S \ d {3} [^ 9 ] then replace with: @ $ 1 - 2009

Just tried it locally, and it worked in the following test cases:

© 2002- 2008
© 2002-2005
© 2002- 2006
+1
source

Dreamweaver, , lookaround - Adobe doesn ' . . , ( , ):

© $1QQQQ2009 , , QQQQ . , - QQQQ -:)

0

Source: https://habr.com/ru/post/1723018/


All Articles