stripping beginning of the line in the function list

Syntax highlighting, code folding, brace matching, code indenting, and function list

stripping beginning of the line in the function list

Postby andrewz » Sat Sep 16, 2006 8:35 am

Hello
I'm customizing UE to do some highlighting for SIP messages and I cannot create the proper Function.

I want to search for all the strings starting with 'SIP/2.0'
and display in the functions list only the rest of the line.

The typical line could be:
SIP/2.0 401 Authentication required
SIP/2.0 100 Trying

and I want to see:
401 Authentication required
100 Trying

thanks!
User avatar
andrewz
Newbie
 
Posts: 4
Joined: Fri Sep 15, 2006 11:00 pm

Re: stripping beginning of the line in the function list

Postby Mofi » Sat Sep 16, 2006 10:44 am

/Function String = "%SIP/2.0[ ^t]+^(*^)$"

^( ^) selects the text which should be displayed in the function list, at this regular expression everything after "SIP/2.0" and the following space(s)/tab(s) till end of the line.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4058
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: stripping beginning of the line in the function list

Postby andrewz » Sat Sep 16, 2006 11:00 am

thank you, it works!

And 2 more questions - is it possible to automatically highlight the following:
- all the 3-digit numbers after 'SIP/2.0 '
- all the digits in the string like 'm=audio 52304 RTP/AVP'

What will be the proper syntax to combine the 2 following lines into one with 'OR':
/Function String 2 = "%REGISTER *"
/Function String 3 = "%INVITE *"

Something like
/Function String 2 = "%^{REGISTER^}^{INVITE^} *"
but this doesn't work for me.

thank you!
User avatar
andrewz
Newbie
 
Posts: 4
Joined: Fri Sep 15, 2006 11:00 pm

Re: stripping beginning of the line in the function list

Postby Mofi » Sun Sep 17, 2006 9:35 am

ALL Numbers are automatically highlighted with the color setting Numbers. It's not possible to highlight just a special number. If the numbers are not highlighted in your file check the color setting for the color group Numbers for your language in the configuration dialog and also the delimiter characters at the line starting with /Delimiters = for your language in the wordfile. Maybe the space and/or the horizontal tab is missing in the list of delimiter characters which should be added to this line between other delimiters.

/Function String 2 = "%^{REGISTER^}^{INVITE^} *$"

should be better. * without a following specification always means 0 characters.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4058
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: stripping beginning of the line in the function list

Postby andrewz » Sun Sep 17, 2006 9:54 am

Mofi wrote:
/Function String 2 = "%^{REGISTER^}^{INVITE^} *$"

should be better. * without a following specification always means 0 characters.


does not work :(

Sample text:
REGISTER sip:domain.net:5060 SIP/2.0
INVITE sip:1234567@domain.net:5060 SIP/2.0
User avatar
andrewz
Newbie
 
Posts: 4
Joined: Fri Sep 15, 2006 11:00 pm

Re: stripping beginning of the line in the function list

Postby Mofi » Sun Sep 17, 2006 10:54 am

I have tried the following 2 regular expressions in the wordfile with UltraEdit and it works fine for the 4 example lines you have posted.

/L20"SIP" Nocase Noquote File Extensions = SIP
/Delimiters = # $tab()*+,./:;<=>\
/Function String = "%SIP/2.0[ ^t]+^(*^)$"
/Function String 1 = "%^{REGISTER^}^{INVITE^} *$"


Have the lines in your wordfile really no preceding white-space characters?

For example this will not work

Code: Select all
 SIP/2.0 401 Authentication required
   SIP/2.0 100 Trying
  REGISTER sip:domain.net:5060 SIP/2.0
    INVITE sip:1234567@domain.net:5060 SIP/2.0


except you insert [ ^t]++ in both regular expression after the % character like shown below (with additional ^(^) in the 2nd regex to trim the preceding white spaces in the function list):

/Function String = "%[ ^t]++SIP/2.0[ ^t]+^(*^)$"
/Function String 1 = "%[ ^t]++^(^{REGISTER^}^{INVITE^} *^)$"


What is your second regular expression function string?

/Function String 2 = is for the 3rd regular expression as you can see for example at /L1"C/C++" in the standard wordfile.txt.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4058
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: stripping beginning of the line in the function list

Postby andrewz » Sun Sep 17, 2006 2:01 pm

thank you for the answer!
Actually it was my fault - I've made incorrect description. In fact I'm trying to put more then 2 words on the same string (2 words are OK), and this does not work:

/Function String = "%^{REGISTER^}^{INVITE^}^{ACK^} *$"

should I create a separate function string for each pair of the words?
User avatar
andrewz
Newbie
 
Posts: 4
Joined: Fri Sep 15, 2006 11:00 pm

Re: stripping beginning of the line in the function list

Postby Mofi » Mon Sep 18, 2006 9:49 am

Yes! The UltraEdit style OR expression allows only 2 arguments: A OR B. More is not possible.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4058
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna


Return to Syntax Highlighting