The syntax for regular expressions in Visual studio's find and replace option are incredibly convoluted.
I wanted to replace all instances of width in a style sheet with something that was variable based.
so width:75px; would become width:@(width=75)px;
This syntax is using the new Razor view engine and the result is we set a local variable and render it to the page in a nice terse expression. Combined with:
left:@(leftStart+width)px;
we now have the beginning of a nice sliced row of images. Where all the things on a particular row would incrementally build, and then on the next row, I can reset leftStart.
This was the syntax for finding all lines of an html document and capturing the width:
width\:{[0-9]+}
And the syntax for the replacement?
width\:\@(width=\1)
I understand that c# syntax uses a ton of the same conflicting symbols, but... could you guys make something like rexexpal so that we can iteratively solve for the expressions we need?
When Abstractions Break
1 week ago
No comments:
Post a Comment