Selecting text by fixed number of chars from actual pos.

Help with writing and running scripts

Selecting text by fixed number of chars from actual pos.

Postby cosco » Mon Apr 07, 2008 10:54 am

How do I select a text from actual position to a specific position?

Example:

I want selection 1000 chars from actual position to ahead, with [startSelect + key("RIGHT ARROW")] is very slow and with [startSelect + key("DOWN ARROW") + key("RIGHT ARROW")] is more fast, but I want better velocity.

I am sorry for my English...
cosco
Newbie
 
Posts: 5
Joined: Mon Apr 07, 2008 10:38 am

Re: Selecting text by fixed number of chars from actual pos.

Postby pietzcker » Mon Apr 07, 2008 12:59 pm

I assume you're using the current version (V14).

Position the cursor before the first letter. Press Ctrl+F (Find dialog should open). Check the checkbox "Regular expressions" in the lower left of the dialog box. Click on "Advanced" (lower right corner) and select "Perl" regular expressions. Then search for [^ÿ]{1000}.
(ÿ is chosen here as a character that doesn't occur anywhere in your file)

I'm not sure about the correct syntax for this inside a script, but I'm sure you'll find examples of regex find operations in this forum.

HTH,
Tim
User avatar
pietzcker
Master
Master
 
Posts: 241
Joined: Sun Aug 22, 2004 11:00 pm

Re: Selecting text by fixed number of chars from actual pos.

Postby cosco » Mon Apr 07, 2008 1:39 pm

Wow!!!! 8O

Thanks you!!!

I will work with this, and I will try to do the code in Script
cosco
Newbie
 
Posts: 5
Joined: Mon Apr 07, 2008 10:38 am

Re: Selecting text by fixed number of chars from actual pos.

Postby mjcarman » Tue Apr 08, 2008 8:55 am

pietzcker wrote:[^ÿ]{1000}
(ÿ is chosen here as a character that doesn't occur anywhere in your file)

I really wish that UE provided some documentation about how they implement Perl regexes. It looks like they hard-code the /m modifier ("^" and "$" match at beginning and end of each line) to true and the /s modifier ("." matches newline) to false. I'd like to be able to control the modifiers but that might be too much for most users (who don't actually program in Perl).

The feature I really want is for "\n" to match a logical newline regardless of the file encoding. (I did file a request, but I'm not holding out much hope.)
User avatar
mjcarman
Power User
Power User
 
Posts: 125
Joined: Thu Feb 10, 2005 12:00 am


Return to Scripts