Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Feature Requests
 matching )]} in strings
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

daThomas
Junior Member

15 Posts

Posted - Jan 31 2006 :  04:32:32 AM  Show Profile  Reply with Quote
Hi,

i use strings to define layerstacks for views. It would be very cool to see the corresponding bracket when editing these strings. is taht possible?

example:
"PlaneTransformation(Prototype(viewingant::DefaultSliceSetWidthPlaneTransformation))"
  "SliceSetAccessor(Prototype(viewingant::SliceSetAccessor))"
  "Trackable(Prototype(ThreeDTrackable)))"
  "pimp3d::ZBuffer3DPlacementLayer("
    "pimp3d::ThreeDTrackableDraggingInterstateLayer()"
       "viewingant::ThreeDPlaneViewLayerSwitchLayer("
         "viewingant::ThreeDPlaneViewLayer())))"

jpizzi
Tomato Guru

USA
642 Posts

Posted - Jan 31 2006 :  10:45:40 PM  Show Profile  Reply with Quote
One possibility would be to construct the strings without the quotes, then add them after completion, using the 'surround with ""' feature. VA should highlight matching brackets during the construction, then you have your quotes, like you need afterwards.

Joe Pizzi
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19003 Posts

Posted - Feb 01 2006 :  4:04:24 PM  Show Profile  Reply with Quote
unfortunately VA does not have a surround with double quotes feature. there was a discussion about this a while ago, and no one could come up with a solid reason for this, until now

i have certainly constructed strings without the double quotes to get this sort of help myself before now. plus with a bit of care you should be able to use find and replace in regular expression mode to insert the double quotes for you once you are finished.

zen is the art of being at one with the two'ness
Go to Top of Page

jpizzi
Tomato Guru

USA
642 Posts

Posted - Feb 01 2006 :  9:06:40 PM  Show Profile  Reply with Quote
For the find and replace expression, if you first highlight the code you want "string-ified", you can use the following find and replace strings:
find what: ^{.+}$
replace with: "\\1"

Note: the second one _does_ include the quotes (unlike many examples that people give).

Joe Pizzi
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19003 Posts

Posted - Feb 02 2006 :  4:13:40 PM  Show Profile  Reply with Quote
interesting! reading that i can see what you are doing, even though i am not familiar with the \\1 notation. having just tried it, since i am curious, in VS2003 doing a find and replace "using regular expression" i am being told the search string cannot be found *puzzled*

how can "one or more of any character" not be found in a selected block of text?

zen is the art of being at one with the two'ness
Go to Top of Page

jpizzi
Tomato Guru

USA
642 Posts

Posted - Feb 02 2006 :  11:13:18 PM  Show Profile  Reply with Quote
Well, I took this right out of the find and replace dialog in VS 2003, too.

Maybe there is something from the web disturbing it? The find string was constructed from:
Beginning of line
Tag expression
Any character
One or more times
(move the cursor outside the braces)
End of line

The replace with string is:
double quote
Tagged expression 1
double quote

Make sure you have the "Use:" set to "Regular expressions". With the exception of the quotes, everything was selected off the right-pointing arrow after the drop-down of the combo box.

Oh, I just realized what might be the issue: This find-and-replace is setup to only do complete lines (the ^ at the front and the $ at the back). If you didn't have an entire line selected, it wouldn't work. For an arbitrary selection, drop the ^ and $ from the find what text.

Joe Pizzi

Edited by - jpizzi on Feb 02 2006 11:15:37 PM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19003 Posts

Posted - Feb 04 2006 :  2:50:09 PM  Show Profile  Reply with Quote
most odd. i had made the wild assumption that since i had told find and replace to operate on the selection only that the ^ and $ codes would apply to the start and end of the selection. not a bad theory, but not valid.

testing this with whole lines selected it works perfectly, just as expected. however even after removing the ^ and $ i am getting "not found" when trying this on a piece of text in the middle of a line. i am probably going to have to look up the help on the find and replace regex syntax at some point.

zen is the art of being at one with the two'ness
Go to Top of Page

jpizzi
Tomato Guru

USA
642 Posts

Posted - Feb 05 2006 :  12:08:01 AM  Show Profile  Reply with Quote
Interesting. I just tried it myself, and you are right, it doesn't work. My guess is that since the expression will match EVERYTHING, it assumes that isn't right, so doesn't match. Actually, when I tried it, it matches something later. I couldn't determine what the criteria for the match really was.

It might be that for an arbitrary selection, a macro might be better. For the O/P's example, however, my regex should work just fine. His (her?) example had numerous strings as complete lines.

Joe Pizzi

Edited by - jpizzi on Feb 05 2006 12:08:23 AM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19003 Posts

Posted - Feb 06 2006 :  1:02:46 PM  Show Profile  Reply with Quote
very true, and definitely an interesting solution.

this is the problem i have with regular expressions, they seem to be slightly different in every program that supports them *rolls eyes*

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000