From: Dev <de...@ti...> - 2003-06-05 18:51:29
|
Hi, I am not soo good at it either... but got some help from ultraedit... Se the attatchment Regards Daniel > Hi, > > I'm not too familiar with the regex object so I'm > wondering if anyone can help me out? Here's an example > of what I'm trying to do: > > var s=" test <table>{@field1}</table2> this is a > test{@field2} {@field3:[test message]} tht ere > {@field4:[test message4]}"; > var r= /\{@.+?\}/g; > var a= s.match(r) > s=a.join() > s=s.replace(/\{@(\w+?)\W.+?\}/g,'$1'); > alert(s) > > > I would like the use regex to get all the field names > withing the a string then use another regex to get all > multi-line field names and their content > ({@fieldname:[content]}). Is this possible? > > Many thanks > > -- > Raymond Irving > > > > __________________________________ > Do you Yahoo!? > Yahoo! Calendar - Free online calendar with sync to Outlook(TM). > http://calendar.yahoo.com > > > ------------------------------------------------------- > This SF.net email is sponsored by: Etnus, makers of TotalView, The best > thread debugger on the planet. Designed with thread debugging features > you've never dreamed of, try TotalView 6 free at www.etnus.com. > _______________________________________________ > Dynapi-Dev mailing list > Dyn...@li... > http://www.mail-archive.com/dyn...@li.../ |
From: Leif W <war...@us...> - 2003-06-05 23:20:30
|
Hello, I'm familiar (but not expert) with regexp usage from Perl and PHP, as well as sed. I've taken a look and separated the variable names to keep track of things. var s = " test <table>{@field1}</table2> this is a test{@field2} {@field3:[test message]} tht ere {@field4:[test message4]}"; var r = /\{@.+?\}/g; var a = s.match(r); var t = a.join(); var u = t.replace(/\{@(\w+?)\W.+?\}/g,'$1'); alert( 't\t: ' + t + '\n' + 'u\t: ' + u ); In this example, _t_ has the proper values, but _u_ is missing field2 (same in IE and Mozilla). So maybe a problem with t.replace. I'll keep looking. This preceeds the original question about matching multiple lines. Can you give an example of multi-line field names? Or is it multi-line content? Like this? {@multi- line- field- name:[multi- line- content]} Leif ----- Original Message ----- From: "Dev" <de...@ti...> To: "Raymond Irving" <xw...@ya...>; "DynAPI-Dev" <dyn...@li...> Sent: Thursday, June 05, 2003 2:58 PM Subject: Re: [Dynapi-Dev] Help need with RegEx object > Hi, I am not soo good at it either... but got some help from ultraedit... > > Se the attatchment > > Regards > Daniel > > > Hi, > > > > I'm not too familiar with the regex object so I'm > > wondering if anyone can help me out? Here's an example > > of what I'm trying to do: > > > > var s=" test <table>{@field1}</table2> this is a > > test{@field2} {@field3:[test message]} tht ere > > {@field4:[test message4]}"; > > var r= /\{@.+?\}/g; > > var a= s.match(r) > > s=a.join() > > s=s.replace(/\{@(\w+?)\W.+?\}/g,'$1'); > > alert(s) > > > > > > I would like the use regex to get all the field names > > withing the a string then use another regex to get all > > multi-line field names and their content > > ({@fieldname:[content]}). Is this possible? > > > > Many thanks > > > > -- > > Raymond Irving > > > > > > > > __________________________________ > > Do you Yahoo!? > > Yahoo! Calendar - Free online calendar with sync to Outlook(TM). > > http://calendar.yahoo.com > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: Etnus, makers of TotalView, The best > > thread debugger on the planet. Designed with thread debugging features > > you've never dreamed of, try TotalView 6 free at www.etnus.com. > > _______________________________________________ > > Dynapi-Dev mailing list > > Dyn...@li... > > http://www.mail-archive.com/dyn...@li.../ > > ---------------------------------------------------------------------------- ---- > UltraEdit allows for Regular Expressions in many of its search and replace functions listed under the Search Menu. > > Regular expressions allow more complex search and replace functions to be performed in a single operation. > > There are twopossible sets of syntax that may be used. The first table below shows the original UltraEdit syntax used in earlier versions of UltraEdit. The second table shows the optional "Unix" style regular expressions. This may be enabled from the ConfigurationSection. > > Regular Expressions (UltraEdit Syntax): > > Symbol Function > % Matches the start of line - Indicates the search string must be at the beginning of a line but does not include any line terminator characters in the resulting string selected. > $ Matches the end of line - Indicates the search string must be at the end of line but does not include any line terminator characters in the resulting string selected. > ? Matches any single character except newline > * Matches any number of occurrences of any character except newline > + Matches one or more of the preceding character/expression. At least one occurrence of the character must be found. > ++ Matches the preceding character/expression zero or more times. > ^b Matches a page break > ^p Matches a newline (CR/LF) (paragraph) (DOS Files) > ^r Matches a newline (CR Only) (paragraph) (MAC Files) > ^n Matches a newline (LF Only) (paragraph) (UNIX Files) > ^t Matches a tab character > [ ] Matches any single character, or range in the brackets > ^{A^}^{B^} Matches expression A OR B > ^ Overrides the following regular expression character > ^(.^) Brackets or tags an expression to use in the replace command. A regular expression may have up to 9 tagged expressions, numbered according to their order in the regular expression.The corresponding replacement expression is ^x, for x in the range 1-9. Example: If ^(h*o^) ^(f*s^) matches "hello folks", ^2 ^1 would replace it with "folks hello". > Note - ^ refers to the character '^' NOT Control Key + value. > > Examples: > > m?n matches "man", "men", "min" but not "moon". > > t*t matches "test", "tonight" and "tea time" (the "tea t" portion) but not "tea > time" (newline between "tea " and "time"). > > Te+st matches "test", "teest", "teeeest" etc. but does not match "tst". > > [aeiou] matches every lowercase vowel > [,.?] matches a literal ",", "." or "?". > [0-9, a-z] matches any digit, or lowercase letter > [~0-9] matches any character except a digit (~ means NOT the following) > > You may search for an expression A or B as follows: > > "^{John^}^{Tom^}" > > This will search for an occurrence of John or Tom. There should be nothing between the two expressions. > > You may combine A or B and C or D in the same search as follows: > > "^{John^}^{Tom^} ^{Smith^}^{Jones^}" > > > This will search for John or Tom followed by Smith or Jones. > > The table below shows the syntax for the "Unix" style regular expressions. > > Regular Expressions (Unix Syntax): > > Symbol Function > \ Marks the next character as a special character. "n" matches the character "n". "\n" matches a linefeed or newline character. > ^ Matches/anchors the beginning of line. > $ Matches/anchors the end of line. > * Matches the preceding character zero or more times. > + Matches the preceding character one or more times. > . Matches any single character except a newline character. > (expression) Brackets or tags an expression to use in the replace command.A regular expression may have up to 9 tagged expressions, numbered according to their order in the regular expression.The corresponding replacement expression is \x, for x in the range 1-9. Example: If (h.*o) (f.*s) matches "hello folks", \2 \1 would replace it with "folks hello". > [xyz] A character set. Matches any characters between brackets. > [^xyz] A negative character set. Matches any characters NOT between brackets. > \d Matches a digit character. Equivalent to [0-9]. > \D Matches a nondigit character. Equivalent to [^0-9]. > \f Matches a form-feed character. > \n Matches a linefeed character. > \r Matches a carriage return character. > \s Matches any white space including space, tab, form-feed, etc but not newline. > \S Matches any nonwhite space character but not newline. > \t Matches a tab character. > \v Matches a vertical tab character. > \w Matches any word character including underscore. > \W Matches any nonword character. > Note - ^ refers to the character '^' NOT Control Key + value. > > Examples: > > m.n matches "man", "men", "min" but not "moon". > > Te+st matches "test", "teest", "teeeest" etc. BUT NOT "tst". > > Te*st matches "test", "teest", "teeeest" etc. AND "tst". > > [aeiou] matches every lowercase vowel > [,.?] matches a literal ",", "." or "?". > [0-9, a-z] matches any digit, or lowercase letter > [^0-9] matches any character except a digit (^ means NOT the following) > > You may search for an expression A or B as follow: > > "(John|Tom)" > > This will search for an occurrence of John or Tom. There should be nothing between the two expressions. > > You may combine A or B and C or D in the same search as follows: > > "(John|Tom) (Smith|Jones)" > > > This will search for John or Tom followed by Smith or Jones. > > Additionally: > > \p Matches CR/LF (same as \r\n) to match a DOS line terminator > > If Regular Expression is not selected for the find/replace and in the Replace field the following special characters are also valid: > > Symbol Function > ^^ Matches a "^" character > ^s Is substituted with the selected (highlighted) text of the active file window. > ^c Is substituted with the contents of the clipboard. > ^b Matches a page break > ^p Matches a newline (CR/LF) (paragraph) (DOS Files) > ^r Matches a newline (CR Only) (paragraph) (MAC Files) > ^n Matches a newline (LF Only) (paragraph) (UNIX Files) > ^t Matches a tab character > > Note - ^ refers to the character '^' NOT Control Key + value. |
From: Raymond I. <xw...@ya...> - 2003-06-06 02:35:17
|
See below: --- Leif W <war...@us...> wrote: > Hello, > > I'm familiar (but not expert) with regexp usage from > Perl and PHP, as well > as sed. I've taken a look and separated the > variable names to keep track of > things. > > var s = " test <table>{@field1}</table2> this is a > test{@field2} > {@field3:[test message]} tht ere {@field4:[test > message4]}"; > var r = /\{@.+?\}/g; > var a = s.match(r); > var t = a.join(); > var u = t.replace(/\{@(\w+?)\W.+?\}/g,'$1'); > alert( > 't\t: ' + t + '\n' + > 'u\t: ' + u > ); > > In this example, _t_ has the proper values, but _u_ > is missing field2 (same > in IE and Mozilla). So maybe a problem with > t.replace. I'll keep looking. > This preceeds the original question about matching > multiple lines. Can you > give an example of multi-line field names? Or is it > multi-line content? > Like this? Thanks for you help thus far. As for the milti-line question I was making reference to embedded field with (multi-line) content: {@fieldname:[some content here]} {@fieldname:[ some more multi-line content here ]} and field without content can be represented as: {@fieldname} {@fieldname:[]} // same as {@fieldname} -- Raymond Irving > > {@multi- > line- > field- > name:[multi- > line- > content]} > > > Leif > > > ----- Original Message ----- > From: "Dev" <de...@ti...> > To: "Raymond Irving" <xw...@ya...>; > "DynAPI-Dev" > <dyn...@li...> > Sent: Thursday, June 05, 2003 2:58 PM > Subject: Re: [Dynapi-Dev] Help need with RegEx > object > > > > Hi, I am not soo good at it either... but got some > help from ultraedit... > > > > Se the attatchment > > > > Regards > > Daniel > > > > > Hi, > > > > > > I'm not too familiar with the regex object so > I'm > > > wondering if anyone can help me out? Here's an > example > > > of what I'm trying to do: > > > > > > var s=" test <table>{@field1}</table2> this is a > > > test{@field2} {@field3:[test message]} tht ere > > > {@field4:[test message4]}"; > > > var r= /\{@.+?\}/g; > > > var a= s.match(r) > > > s=a.join() > > > s=s.replace(/\{@(\w+?)\W.+?\}/g,'$1'); > > > alert(s) > > > > > > > > > I would like the use regex to get all the field > names > > > withing the a string then use another regex to > get all > > > multi-line field names and their content > > > ({@fieldname:[content]}). Is this possible? > > > > > > Many thanks > > > > > > -- > > > Raymond Irving > > > > > > > > > > > > __________________________________ > > > Do you Yahoo!? > > > Yahoo! Calendar - Free online calendar with sync > to Outlook(TM). > > > http://calendar.yahoo.com > > > > > > > > > > ------------------------------------------------------- > > > This SF.net email is sponsored by: Etnus, > makers of TotalView, The best > > > thread debugger on the planet. Designed with > thread debugging features > > > you've never dreamed of, try TotalView 6 free at > www.etnus.com. > > > _______________________________________________ > > > Dynapi-Dev mailing list > > > Dyn...@li... > > > > http://www.mail-archive.com/dyn...@li.../ > > > > > > > ---------------------------------------------------------------------------- > ---- > > > > UltraEdit allows for Regular Expressions in many > of its search and replace > functions listed under the Search Menu. > > > > Regular expressions allow more complex search and > replace functions to be > performed in a single operation. > > > > There are twopossible sets of syntax that may be > used. The first table > below shows the original UltraEdit syntax used in > earlier versions of > UltraEdit. The second table shows the optional > "Unix" style regular > expressions. This may be enabled from the > ConfigurationSection. > > > > Regular Expressions (UltraEdit Syntax): > > > > Symbol Function > > % Matches the start of line - Indicates the search > string must be at the > beginning of a line but does not include any line > terminator characters in > the resulting string selected. > > $ Matches the end of line - Indicates the search > string must be at the end > of line but does not include any line terminator > characters in the resulting > string selected. > > ? Matches any single character except newline > > * Matches any number of occurrences of any > character except newline > > + Matches one or more of the preceding > character/expression. At least one > occurrence of the character must be found. > > ++ Matches the preceding character/expression zero > or more times. > > ^b Matches a page break > > ^p Matches a newline (CR/LF) (paragraph) (DOS > Files) > > ^r Matches a newline (CR Only) (paragraph) (MAC > Files) > > ^n Matches a newline (LF Only) (paragraph) (UNIX > Files) > > ^t Matches a tab character > > [ ] Matches any single character, or range in the > brackets > > ^{A^}^{B^} Matches expression A OR B > > ^ Overrides the following regular expression > character > > ^(.^) Brackets or tags an expression to use in the > replace command. A > regular expression may have up to 9 tagged > expressions, numbered according > to their order in the regular expression.The > corresponding replacement > expression is ^x, for x in the range 1-9. Example: > If ^(h*o^) ^(f*s^) > matches "hello folks", ^2 ^1 would replace it with > "folks hello". > > Note - ^ refers to the character '^' NOT Control > Key + value. > > > > Examples: > > > > m?n matches "man", "men", "min" but not "moon". > > > > t*t matches "test", "tonight" and "tea time" (the > "tea t" portion) but not > "tea > > time" (newline between "tea " and "time"). > > > > Te+st matches "test", "teest", "teeeest" etc. but > does not match "tst". > > > > [aeiou] matches every lowercase vowel > > [,.?] matches a literal ",", "." or "?". > > [0-9, a-z] matches any digit, or lowercase letter > > [~0-9] matches any character except a digit (~ > means NOT the following) > === message truncated === __________________________________ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com |
From: Kevin <ke...@ke...> - 2003-06-08 16:47:46
|
Hi Raymond, Multi line string literals in Javascript would be nice. Though you could escape \ the new line but then it wouldn't be multi line! Sorry no way around this one. If I have understood you are wanting a complex multi line string like your examples below to pass to the template manager. - Kevin "Raymond Irving" <xw...@ya...> wrote: > > See below: > > --- Leif W <war...@us...> wrote: > > Hello, > > > > I'm familiar (but not expert) with regexp usage from > > Perl and PHP, as well > > as sed. I've taken a look and separated the > > variable names to keep track of > > things. > > > > var s = " test <table>{@field1}</table2> this is a > > test{@field2} > > {@field3:[test message]} tht ere {@field4:[test > > message4]}"; > > var r = /\{@.+?\}/g; > > var a = s.match(r); > > var t = a.join(); > > var u = t.replace(/\{@(\w+?)\W.+?\}/g,'$1'); > > alert( > > 't\t: ' + t + '\n' + > > 'u\t: ' + u > > ); > > > > In this example, _t_ has the proper values, but _u_ > > is missing field2 (same > > in IE and Mozilla). So maybe a problem with > > t.replace. I'll keep looking. > > This preceeds the original question about matching > > multiple lines. Can you > > give an example of multi-line field names? Or is it > > multi-line content? > > Like this? > > Thanks for you help thus far. > > As for the milti-line question I was making reference > to embedded field with (multi-line) content: > > {@fieldname:[some content here]} > {@fieldname:[ > some more multi-line > content here > ]} > > and field without content can be represented as: > > {@fieldname} > {@fieldname:[]} // same as {@fieldname} > > -- > Raymond Irving > > > > > {@multi- > > line- > > field- > > name:[multi- > > line- > > content]} > > > > > > Leif > > > > > > ----- Original Message ----- > > From: "Dev" <de...@ti...> > > To: "Raymond Irving" <xw...@ya...>; > > "DynAPI-Dev" > > <dyn...@li...> > > Sent: Thursday, June 05, 2003 2:58 PM > > Subject: Re: [Dynapi-Dev] Help need with RegEx > > object > > > > > > > Hi, I am not soo good at it either... but got some > > help from ultraedit... > > > > > > Se the attatchment > > > > > > Regards > > > Daniel > > > > > > > Hi, > > > > > > > > I'm not too familiar with the regex object so > > I'm > > > > wondering if anyone can help me out? Here's an > > example > > > > of what I'm trying to do: > > > > > > > > var s=" test <table>{@field1}</table2> this is a > > > > test{@field2} {@field3:[test message]} tht ere > > > > {@field4:[test message4]}"; > > > > var r= /\{@.+?\}/g; > > > > var a= s.match(r) > > > > s=a.join() > > > > s=s.replace(/\{@(\w+?)\W.+?\}/g,'$1'); > > > > alert(s) > > > > > > > > > > > > I would like the use regex to get all the field > > names > > > > withing the a string then use another regex to > > get all > > > > multi-line field names and their content > > > > ({@fieldname:[content]}). Is this possible? > > > > > > > > Many thanks > > > > > > > > -- > > > > Raymond Irving > > > > > > > > > > > > > > > > __________________________________ > > > > Do you Yahoo!? > > > > Yahoo! Calendar - Free online calendar with sync > > to Outlook(TM). > > > > http://calendar.yahoo.com > > > > > > > > > > > > > > > ------------------------------------------------------- > > > > This SF.net email is sponsored by: Etnus, > > makers of TotalView, The best > > > > thread debugger on the planet. Designed with > > thread debugging features > > > > you've never dreamed of, try TotalView 6 free at > > www.etnus.com. > > > > _______________________________________________ > > > > Dynapi-Dev mailing list > > > > Dyn...@li... > > > > > > > http://www.mail-archive.com/dyn...@li.../ > > > > > > > > > > > > > ---------------------------------------------------------------------------- > > ---- > > > > > > > UltraEdit allows for Regular Expressions in many > > of its search and replace > > functions listed under the Search Menu. > > > > > > Regular expressions allow more complex search and > > replace functions to be > > performed in a single operation. > > > > > > There are twopossible sets of syntax that may be > > used. The first table > > below shows the original UltraEdit syntax used in > > earlier versions of > > UltraEdit. The second table shows the optional > > "Unix" style regular > > expressions. This may be enabled from the > > ConfigurationSection. > > > > > > Regular Expressions (UltraEdit Syntax): > > > > > > Symbol Function > > > % Matches the start of line - Indicates the search > > string must be at the > > beginning of a line but does not include any line > > terminator characters in > > the resulting string selected. > > > $ Matches the end of line - Indicates the search > > string must be at the end > > of line but does not include any line terminator > > characters in the resulting > > string selected. > > > ? Matches any single character except newline > > > * Matches any number of occurrences of any > > character except newline > > > + Matches one or more of the preceding > > character/expression. At least one > > occurrence of the character must be found. > > > ++ Matches the preceding character/expression zero > > or more times. > > > ^b Matches a page break > > > ^p Matches a newline (CR/LF) (paragraph) (DOS > > Files) > > > ^r Matches a newline (CR Only) (paragraph) (MAC > > Files) > > > ^n Matches a newline (LF Only) (paragraph) (UNIX > > Files) > > > ^t Matches a tab character > > > [ ] Matches any single character, or range in the > > brackets > > > ^{A^}^{B^} Matches expression A OR B > > > ^ Overrides the following regular expression > > character > > > ^(.^) Brackets or tags an expression to use in the > > replace command. A > > regular expression may have up to 9 tagged > > expressions, numbered according > > to their order in the regular expression.The > > corresponding replacement > > expression is ^x, for x in the range 1-9. Example: > > If ^(h*o^) ^(f*s^) > > matches "hello folks", ^2 ^1 would replace it with > > "folks hello". > > > Note - ^ refers to the character '^' NOT Control > > Key + value. > > > > > > Examples: > > > > > > m?n matches "man", "men", "min" but not "moon". > > > > > > t*t matches "test", "tonight" and "tea time" (the > > "tea t" portion) but not > > "tea > > > time" (newline between "tea " and "time"). > > > > > > Te+st matches "test", "teest", "teeeest" etc. but > > does not match "tst". > > > > > > [aeiou] matches every lowercase vowel > > > [,.?] matches a literal ",", "." or "?". > > > [0-9, a-z] matches any digit, or lowercase letter > > > [~0-9] matches any character except a digit (~ > > means NOT the following) > > > === message truncated === > > > __________________________________ > Do you Yahoo!? > Yahoo! Calendar - Free online calendar with sync to Outlook(TM). > http://calendar.yahoo.com > > > ------------------------------------------------------- > This SF.net email is sponsored by: Etnus, makers of TotalView, The best > thread debugger on the planet. Designed with thread debugging features > you've never dreamed of, try TotalView 6 free at www.etnus.com. > _______________________________________________ > Dynapi-Dev mailing list > Dyn...@li... > http://www.mail-archive.com/dyn...@li.../ |
From: Raymond I. <xw...@ya...> - 2003-06-08 18:06:41
|
--- Kevin <ke...@ke...> wrote: > Hi Raymond, > > ... If I have understood you are wanting a > complex multi line string like your examples below > to pass to the template manager. Not really. I'm creating a way to embed container fields with text/html inside a template: var html='Some text here' +'{@field1:[' +' Some text here ' +' more text here' +' {@field2:[' +' Some text/html here for field2' +' Some text here for field2' +' ]} {@field3}' +']}' +'Some text here ' These new type of container fields can be used for retrieving text/html directly from the template: var tp=new Template(html); fld2=tp.getField('field2'); // retrieve field2 alert(fld2); // ^ this will alert "Some text here for field2" fld2+=' Add some text/html'; tp.setField('field2',fld2); // set field2 I think I've found a solution for the above. This solution will allow us to nest container fields as shown above. -- Raymond Irving > - > Kevin > > "Raymond Irving" <xw...@ya...> wrote: > > > > See below: > > > > --- Leif W <war...@us...> wrote: > > > Hello, > > > > > > I'm familiar (but not expert) with regexp usage > from > > > Perl and PHP, as well > > > as sed. I've taken a look and separated the > > > variable names to keep track of > > > things. > > > > > > var s = " test <table>{@field1}</table2> this is > a > > > test{@field2} > > > {@field3:[test message]} tht ere {@field4:[test > > > message4]}"; > > > var r = /\{@.+?\}/g; > > > var a = s.match(r); > > > var t = a.join(); > > > var u = t.replace(/\{@(\w+?)\W.+?\}/g,'$1'); > > > alert( > > > 't\t: ' + t + '\n' + > > > 'u\t: ' + u > > > ); > > > > > > In this example, _t_ has the proper values, but > _u_ > > > is missing field2 (same > > > in IE and Mozilla). So maybe a problem with > > > t.replace. I'll keep looking. > > > This preceeds the original question about > matching > > > multiple lines. Can you > > > give an example of multi-line field names? Or > is it > > > multi-line content? > > > Like this? > > > > Thanks for you help thus far. > > > > As for the milti-line question I was making > reference > > to embedded field with (multi-line) content: > > > > {@fieldname:[some content here]} > > {@fieldname:[ > > some more multi-line > > content here > > ]} > > > > and field without content can be represented as: > > > > {@fieldname} > > {@fieldname:[]} // same as {@fieldname} > > > > -- > > Raymond Irving > > > > > > > > {@multi- > > > line- > > > field- > > > name:[multi- > > > line- > > > content]} > > > > > > > > > Leif > > > > > > > > > ----- Original Message ----- > > > From: "Dev" <de...@ti...> > > > To: "Raymond Irving" <xw...@ya...>; > > > "DynAPI-Dev" > > > <dyn...@li...> > > > Sent: Thursday, June 05, 2003 2:58 PM > > > Subject: Re: [Dynapi-Dev] Help need with RegEx > > > object > > > > > > > > > > Hi, I am not soo good at it either... but got > some > > > help from ultraedit... > > > > > > > > Se the attatchment > > > > > > > > Regards > > > > Daniel > > > > > > > > > Hi, > > > > > > > > > > I'm not too familiar with the regex object > so > > > I'm > > > > > wondering if anyone can help me out? Here's > an > > > example > > > > > of what I'm trying to do: > > > > > > > > > > var s=" test <table>{@field1}</table2> this > is a > > > > > test{@field2} {@field3:[test message]} tht > ere > > > > > {@field4:[test message4]}"; > > > > > var r= /\{@.+?\}/g; > > > > > var a= s.match(r) > > > > > s=a.join() > > > > > s=s.replace(/\{@(\w+?)\W.+?\}/g,'$1'); > > > > > alert(s) > > > > > > > > > > > > > > > I would like the use regex to get all the > field > > > names > > > > > withing the a string then use another regex > to > > > get all > > > > > multi-line field names and their content > > > > > ({@fieldname:[content]}). Is this possible? > > > > > > > > > > Many thanks > > > > > > > > > > -- > > > > > Raymond Irving > > > > > > > > > > > > > > > > > > > > __________________________________ > > > > > Do you Yahoo!? > > > > > Yahoo! Calendar - Free online calendar with > sync > > > to Outlook(TM). > > > > > http://calendar.yahoo.com > > > > > > > > > > > > > > > > > > > > > ------------------------------------------------------- > > > > > This SF.net email is sponsored by: Etnus, > > > makers of TotalView, The best > > > > > thread debugger on the planet. Designed with > > > thread debugging features > > > > > you've never dreamed of, try TotalView 6 > free at > > > www.etnus.com. > > > > > > _______________________________________________ > > > > > Dynapi-Dev mailing list > > > > > Dyn...@li... > > > > > > > > > > > http://www.mail-archive.com/dyn...@li.../ > > > > > > > > > > > > > > > > > > > > ---------------------------------------------------------------------------- > > > ---- > > > > > > > > > > UltraEdit allows for Regular Expressions in > many > > > of its search and replace > > > functions listed under the Search Menu. > > > > > > > > Regular expressions allow more complex search > and > > > replace functions to be > > > performed in a single operation. > > > > > > > > There are twopossible sets of syntax that may > be > > > used. The first table > > > below shows the original UltraEdit syntax used > in > > > earlier versions of > > > UltraEdit. The second table shows the optional > > > "Unix" style regular > > > expressions. This may be enabled from the > > > ConfigurationSection. > > > > > === message truncated === __________________________________ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com |
From: Kevin <ke...@ke...> - 2003-06-10 02:38:58
|
Thanks Raymond, It's a bit clearer now. Pattern matching in perl can be done on embedded new lines. The example below is a string constructed in parts on different lines for clarity - not a multi line string. Glad you have it sorted I quite like regex - a very powerful utilitiy. - Kevin "Raymond Irving" <xw...@ya...> wrote: > --- Kevin <ke...@ke...> wrote: > > Hi Raymond, > > > > ... If I have understood you are wanting a > > complex multi line string like your examples below > > to pass to the template manager. > > Not really. I'm creating a way to embed container > fields with text/html inside a template: > > var html='Some text here' > +'{@field1:[' > +' Some text here ' > +' more text here' > +' {@field2:[' > +' Some text/html here for field2' > +' Some text here for field2' > +' ]} {@field3}' > +']}' > +'Some text here ' > > These new type of container fields can be used for > retrieving text/html directly from the template: > > var tp=new Template(html); > fld2=tp.getField('field2'); // retrieve field2 > alert(fld2); > // ^ this will alert "Some text here for field2" > fld2+=' Add some text/html'; > tp.setField('field2',fld2); // set field2 > > I think I've found a solution for the above. This > solution will allow us to nest container fields as > shown above. > > -- > Raymond Irving > > > - > > Kevin > > > > "Raymond Irving" <xw...@ya...> wrote: > > > > > > See below: > > > > > > --- Leif W <war...@us...> wrote: > > > > Hello, > > > > > > > > I'm familiar (but not expert) with regexp usage > > from > > > > Perl and PHP, as well > > > > as sed. I've taken a look and separated the > > > > variable names to keep track of > > > > things. > > > > > > > > var s = " test <table>{@field1}</table2> this is > > a > > > > test{@field2} > > > > {@field3:[test message]} tht ere {@field4:[test > > > > message4]}"; > > > > var r = /\{@.+?\}/g; > > > > var a = s.match(r); > > > > var t = a.join(); > > > > var u = t.replace(/\{@(\w+?)\W.+?\}/g,'$1'); > > > > alert( > > > > 't\t: ' + t + '\n' + > > > > 'u\t: ' + u > > > > ); > > > > > > > > In this example, _t_ has the proper values, but > > _u_ > > > > is missing field2 (same > > > > in IE and Mozilla). So maybe a problem with > > > > t.replace. I'll keep looking. > > > > This preceeds the original question about > > matching > > > > multiple lines. Can you > > > > give an example of multi-line field names? Or > > is it > > > > multi-line content? > > > > Like this? > > > > > > Thanks for you help thus far. > > > > > > As for the milti-line question I was making > > reference > > > to embedded field with (multi-line) content: > > > > > > {@fieldname:[some content here]} > > > {@fieldname:[ > > > some more multi-line > > > content here > > > ]} > > > > > > and field without content can be represented as: > > > > > > {@fieldname} > > > {@fieldname:[]} // same as {@fieldname} > > > > > > -- > > > Raymond Irving > > > > > > > > > > > {@multi- > > > > line- > > > > field- > > > > name:[multi- > > > > line- > > > > content]} > > > > > > > > > > > > Leif > > > > > > > > > > > > ----- Original Message ----- > > > > From: "Dev" <de...@ti...> > > > > To: "Raymond Irving" <xw...@ya...>; > > > > "DynAPI-Dev" > > > > <dyn...@li...> > > > > Sent: Thursday, June 05, 2003 2:58 PM > > > > Subject: Re: [Dynapi-Dev] Help need with RegEx > > > > object > > > > > > > > > > > > > Hi, I am not soo good at it either... but got > > some > > > > help from ultraedit... > > > > > > > > > > Se the attatchment > > > > > > > > > > Regards > > > > > Daniel > > > > > > > > > > > Hi, > > > > > > > > > > > > I'm not too familiar with the regex object > > so > > > > I'm > > > > > > wondering if anyone can help me out? Here's > > an > > > > example > > > > > > of what I'm trying to do: > > > > > > > > > > > > var s=" test <table>{@field1}</table2> this > > is a > > > > > > test{@field2} {@field3:[test message]} tht > > ere > > > > > > {@field4:[test message4]}"; > > > > > > var r= /\{@.+?\}/g; > > > > > > var a= s.match(r) > > > > > > s=a.join() > > > > > > s=s.replace(/\{@(\w+?)\W.+?\}/g,'$1'); > > > > > > alert(s) > > > > > > > > > > > > > > > > > > I would like the use regex to get all the > > field > > > > names > > > > > > withing the a string then use another regex > > to > > > > get all > > > > > > multi-line field names and their content > > > > > > ({@fieldname:[content]}). Is this possible? > > > > > > > > > > > > Many thanks > > > > > > > > > > > > -- > > > > > > Raymond Irving > > > > > > > > > > > > > > > > > > > > > > > > __________________________________ > > > > > > Do you Yahoo!? > > > > > > Yahoo! Calendar - Free online calendar with > > sync > > > > to Outlook(TM). > > > > > > http://calendar.yahoo.com > > > > > > > > > > > > > > > > > > > > > > > > > > > > ------------------------------------------------------- > > > > > > This SF.net email is sponsored by: Etnus, > > > > makers of TotalView, The best > > > > > > thread debugger on the planet. Designed with > > > > thread debugging features > > > > > > you've never dreamed of, try TotalView 6 > > free at > > > > www.etnus.com. > > > > > > > > _______________________________________________ > > > > > > Dynapi-Dev mailing list > > > > > > Dyn...@li... > > > > > > > > > > > > > > > > http://www.mail-archive.com/dyn...@li.../ > > > > > > > > > > > > > > > > > > > > > > > > > > > > ---------------------------------------------------------------------------- > > > > ---- > > > > > > > > > > > > > UltraEdit allows for Regular Expressions in > > many > > > > of its search and replace > > > > functions listed under the Search Menu. > > > > > > > > > > Regular expressions allow more complex search > > and > > > > replace functions to be > > > > performed in a single operation. > > > > > > > > > > There are twopossible sets of syntax that may > > be > > > > used. The first table > > > > below shows the original UltraEdit syntax used > > in > > > > earlier versions of > > > > UltraEdit. The second table shows the optional > > > > "Unix" style regular > > > > expressions. This may be enabled from the > > > > ConfigurationSection. > > > > > > > > === message truncated === > > > __________________________________ > Do you Yahoo!? > Yahoo! Calendar - Free online calendar with sync to Outlook(TM). > http://calendar.yahoo.com > > > ------------------------------------------------------- > This SF.net email is sponsored by: Etnus, makers of TotalView, The best > thread debugger on the planet. Designed with thread debugging features > you've never dreamed of, try TotalView 6 free at www.etnus.com. > _______________________________________________ > Dynapi-Dev mailing list > Dyn...@li... > http://www.mail-archive.com/dyn...@li.../ |