From: Patrice on
> Be aware that any regular expression is very much slower then any direct
> method as you don't need more than 10 methods.

Yes that's why I suggested looking at the VS IDE that allows to switch
regular expression support on or off as needed....

For now it looks a bit weird to me to use a VB.NET expression to enter
characters that are easily entered using the keyboard (and you also have the
Alt-<Num code> keys sequence or you could call charmap) so instead of using
vb.net expressions to enter characters I would use just what the user
entered using the keyboard and would let the user to activate regular
expression when needed (for example to signal the end of the line if this is
what vbCrLf is intended for in the sample).

--
Patrice


From: Freddy Coal on
Cor and Patrice, thanks for the answer; I know the regular expressions, but
my problem is how get the pattern string if the user put that in a Textbox.

I would like get the chain the same way that when you write in Vb.Net, for
example:

Dim User_Pattern as string = "Hello" & chr(65) & chr(135)

If I make that in Vb.Net, I get in the User_Pattern: "HelloA�"

But if the user put in a Textbox: "Hello" & chr(65) & chr(135) , and I get
that in a chain (textbox.text), I obtain:

""Hello" & chr(65) & chr(135)"

Obviously, if I use that like a pattern, the regex don't replace anything,
because he search for all the string, not for the ascii characters for 65
(A) and 135 (�),
maybe I can depure my string, but exist another especial "characters" like
vbcrlf, or when the user put strange characters with the keyboard Alt+##.

Exits a command of make a trim "comiles" in a string variable?

Thanks in advance.

Freddy Coal.

"Patrice" <http://www.chez.com/scribe/> wrote in message
news:uVROIwP3IHA.1196(a)TK2MSFTNGP05.phx.gbl...
>> Be aware that any regular expression is very much slower then any direct
>> method as you don't need more than 10 methods.
>
> Yes that's why I suggested looking at the VS IDE that allows to switch
> regular expression support on or off as needed....
>
> For now it looks a bit weird to me to use a VB.NET expression to enter
> characters that are easily entered using the keyboard (and you also have
> the Alt-<Num code> keys sequence or you could call charmap) so instead of
> using vb.net expressions to enter characters I would use just what the
> user entered using the keyboard and would let the user to activate regular
> expression when needed (for example to signal the end of the line if this
> is what vbCrLf is intended for in the sample).
>
> --
> Patrice
>


From: Christiano on
why don't you write a function that will read the input and replace...

p.e.,
- count how many times the chr string occurs.
- for each time, make a mid starting at i and finishing at i+4, where i
is the indexof("chr"), store it in a variable
- in this variable, make another mid, retrieving then code number, and
then eval the chr...
- replace the variable where the chr(code) was stored by the real chr
eval...


i lnow you will be restricted to chr codes... but you still can make a
select for chr, asc, vbcr, vblf, vbcrlf.

the strange chacacters will be, already, parse as string...
if you want to remove them, use the ASCII table
(www.computerhope.com/jargon/a/ascii.htm) and read letter by letter,
checking if the asc( ) code is in the range of numbers and letters...



the easiest way to do things, is the one that works...



"Freddy Coal" <freddycoal(a)gmaiwithoutspam.com> escreveu na mensagem
news:%23RTKJlR3IHA.2060(a)TK2MSFTNGP02.phx.gbl...
> Cor and Patrice, thanks for the answer; I know the regular expressions,
> but my problem is how get the pattern string if the user put that in a
> Textbox.
>
> I would like get the chain the same way that when you write in Vb.Net, for
> example:
>
> Dim User_Pattern as string = "Hello" & chr(65) & chr(135)
>
> If I make that in Vb.Net, I get in the User_Pattern: "HelloA�"
>
> But if the user put in a Textbox: "Hello" & chr(65) & chr(135) , and I
> get that in a chain (textbox.text), I obtain:
>
> ""Hello" & chr(65) & chr(135)"
>
> Obviously, if I use that like a pattern, the regex don't replace anything,
> because he search for all the string, not for the ascii characters for 65
> (A) and 135 (�),
> maybe I can depure my string, but exist another especial "characters" like
> vbcrlf, or when the user put strange characters with the keyboard Alt+##.
>
> Exits a command of make a trim "comiles" in a string variable?
>
> Thanks in advance.
>
> Freddy Coal.
>
> "Patrice" <http://www.chez.com/scribe/> wrote in message
> news:uVROIwP3IHA.1196(a)TK2MSFTNGP05.phx.gbl...
>>> Be aware that any regular expression is very much slower then any direct
>>> method as you don't need more than 10 methods.
>>
>> Yes that's why I suggested looking at the VS IDE that allows to switch
>> regular expression support on or off as needed....
>>
>> For now it looks a bit weird to me to use a VB.NET expression to enter
>> characters that are easily entered using the keyboard (and you also have
>> the Alt-<Num code> keys sequence or you could call charmap) so instead of
>> using vb.net expressions to enter characters I would use just what the
>> user entered using the keyboard and would let the user to activate
>> regular expression when needed (for example to signal the end of the line
>> if this is what vbCrLf is intended for in the sample).
>>
>> --
>> Patrice
>>
>
>


From: Patrice on
>
> But if the user put in a Textbox: "Hello" & chr(65) & chr(135) , and I
> get that in a chain (textbox.text), I obtain:
>
> ""Hello" & chr(65) & chr(135)"
>

So you need to "compile" the user input... What is the level of flexibility
you want ?

You could :
- as suggested by others do your own parsing

If you need to handle "real" code you could use :
- http://support.microsoft.com/kb/304654/en-us (compile to an assembly
rather than to an exe file) and load/call the assembly. It is likely quite
costly.

Another option would be to take advantage of the J# namespace (but then you
would have of course to use j# syntax) :
-
http://www.dotnetjunkies.com/WebLog/debasish/archive/2005/11/11/133688.aspx

I'm not sure why you need to express those chars this way but it looks very
unnatural to me. I would be really surprised to enter "Hello" & Chr(32) in a
search replace box and have all my "Hello World" strings altered as well ??
I'm not sure to catch the benefit you are expecting by expressing literals
using a VB.NET expression. For now it looks rather dangerous to me...

--
Patrice