[Implemented] Regular Expressions

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

[Implemented] Regular Expressions

Post by BackupUser »

Restored from previous forum. Originally posted by Sasa.

Well, I stumbled across PureBasic and I really must say that I love the concept behind it. Than I wanted to to make a lil program reading files, doing some stuff, write back etc. and discovered "there were no regular expressions" ...

This is very sad, cause I really would have liked to register it and really use it. I really need reg exp.

I stumbled over a nice link when surfing grc.com:
http://www.movsd.com/bm.htm
It has the complete source for the "Boyer Moore Exact Pattern Matching Algorithms" in pure Assembler. I, myself, have no experience with programming assembler, but was hoping that this link, if not already known, would be of some help, maybe implementing some kind of regular expressions in PB.

So, for now I will be watching new releases of PB and hope it sometimes soon will incorporate some kind of reg exp, so I can start using it.

All the best
Sasa

Having no sig really is the best sig, isn't it?
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Iontichy.

My words ;o)
See my posting:

viewtopic.php?t=1509 expressions&Forum_Title=Feature Requests and Wishlists



---------------
star traveler
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Sasa.
My words ;o)
See my posting:
I saw your posting and hoped maybe another one of this kind would help a little. But it seems there is no interest at the moment. Not even the interest to say that there is no interest for RegExp at the moment.

A comment on this would be very nice, like well in the next release there will be some pattern matching, or, well if you need patter matching, we can't help you.

Still hoping.

Sasa

Having no sig really is the best sig, isn't it?
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by El_Choni.

Hi,

I also missed regular expressions when I started coding with PB. I even thought of coding a library with a small subset, but then I realized that, even with few capabilities, it would be a huge work. But there must be some third party libs out there which can be used for that, I think. Anyway, I hope, as you do, that Fred implements it soon or later. In the meanwhile, I think PB is the best choice, even without natuve regular expressions handling.

Bye,

El_Choni
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by PB.

> there must be some third party libs out there which can be used for that

There's dozens of ActiveX libraries for Visual Basic, which is why I'd love to
see PureBasic support ActiveX in a future release.

PB - Registered PureBasic Coder
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Franco.
> there must be some third party libs out there which can be used for that

There's dozens of ActiveX libraries for Visual Basic, which is why I'd love to
see PureBasic support ActiveX in a future release.

PB - Registered PureBasic Coder
ActiveX works only on Windows if I recall it right.
And a library for such a thing would work on every OS.
Just my 2c.


Have a nice day...
Franco

Sometimes you have to go a lonely way to accomplish genius things.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Franco.

Hi Sasa,
don't know how familiar you are with coding, but eventually you could start to write functions for regular expressions?

But like El_Choni said, it's a big task, and if there are only a view user that would use it...


Have a nice day...
Franco

Sometimes you have to go a lonely way to accomplish genius things.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by PB.

> ActiveX works only on Windows if I recall it right.
> And a library for such a thing would work on every OS.

You're right: ActiveX is only for Windows, and a library for Regular Expressions
should support Amiga/Linux also; I agree. Still, support of ActiveX would be nice.

PB - Registered PureBasic Coder
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Danilo.

>ActiveX works only on Windows if I recall it right.
>And a library for such a thing would work on every OS.

No. You cant use the same library on every OS.

cya,
...Danilo

(registered PureBasic user)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Franco.
>ActiveX works only on Windows if I recall it right.
>And a library for such a thing would work on every OS.

No. You cant use the same library on every OS.

cya,
...Danilo

(registered PureBasic user)
Why not
THIS library works only with STRINGS not with OS related stuff...

Suppose you meant libraries that make use of OS related stuff

BUT sure I can be wrong, you have already done a library for PureBasic....
So please can you be more specific

Have a nice day...
Franco

Sometimes you have to go a lonely way to accomplish genius things.

Edited by - franco on 02 July 2002 19:57:29
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Danilo.

@Franco:
> Why not
> THIS library works only with STRINGS not with OS related stuff...

You were talking about ActiveX in your posting.
No word about Regular Expressions there..

> Suppose you meant libraries that make use of OS related stuff

Yes. Nearly every library needs some OS functions.
You cant allocate memory with plain ASM, because
that requires a function provided by the OS.

Anyway... you said "And a library for such a thing would work on every OS."
and i answered "You cant use the same library on every OS.".

"every OS." - in both, got it now ??

PureBasic is available for Linux, Windows and AmigaOS atm.
No library will run on all 3 Operating Systems, because
PureBasic /AmigaOS doesnt work on x86.

> BUT sure I can be wrong, you have already done a library
> for PureBasic....

Yes, i have done 9 libraries for PureBasic so far
and i know how computers work and assembly language
for 13 years now. I think i know what i´m talking about.

> So please can you be more specific

AmigaOS Windows or Linux - because its not x86.

For some very simple commands that need no OS call
it could be possible for Windows and Linux (no AmigaOS),
if PureBasic for Linux is using the same calling
conventions and the same library format like PB /Windows.
But you know that the Regular Expression stuff isnt simple.

As i said: _most_ libraries need some memory
management functions, even if its only "simple"
String handling.

But hey, why dont YOU write the regular expression stuff ??
Its ONLY some string thingy.
Maybe YOU can do it with 100% compatibility, so everybody
can use the lib on Amiga, Linux and Windows.

Its useless to talk about _theoretical_ stuff all the time.
Theory Practice

The same for the thread "Automatic gadget numbering via names".
IMO its not a good idea and totally senseless, but better
i shaddup now before i get flamed here...

Have fun,
...Danilo

(registered PureBasic user)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by PB.

> The same for the thread "Automatic gadget numbering via names".
> IMO its not a good idea and totally senseless, but better
> i shaddup now before i get flamed here...

I'm not going to flame you -- it's obvious that some of you don't understand
what I mean. What is better: for the user to manually assign a number to every
gadget, or to let PureBasic do it? Not senseless at all. PureBasic would still
be using gadget numbers for every gadget, except that the user doesn't choose
what those numbers are -- what's wrong with that?

PB - Registered PureBasic Coder
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Danilo.

>PureBasic would still be using gadget numbers for every gadget,
>except that the user doesn't choose what those numbers are --
>what's wrong with that?

You want to hide more stuff from the coder ??

The real Problem:
You cant assign values to a Constant at runtime, so
this should be done by the Compiler.
The PB compiler is very simple and i dont think Fred
will add this. The Compiler doesnt optimize the output,
the compiler cant find procedures itself (you have to
use "Declare" for that), so do you really think Fred
will add this ??

And whats better with writing
ListViewGadget(#ListView1,... instead
ListViewGadget(1,... ??

And if you want to use Constants, is it really
a problem to make an include-file with #ListView1 = 1 ??

I am also lazy (hi Paul ), but this shouldnt be a problem.
Really.

Addition:
And if you want the compiler to assign a number
to a constant, how do you think this should work ??
_I_ tell the compiler what the value of the constant is -
because _I_ write the code.
Now, _which_ Constants does the compiler assign automatically ??
Only the Constants that begin with #ListView... or with #Memory... ??
All Constants that are not declared before ??
Thats a weird system and you could get errors in your
program if something goes wrong.
When i write "#ListView1 = 1" i know for sure it has the value of 1.

cya,
...Danilo
(registered PureBasic user)

Edited by - Danilo on 03 July 2002 12:11:40
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by PB.

> You want to hide more stuff from the coder ??

If you think about it, it's no different to using, for example, the constant
#WS_MINIMIZEBOX instead of $20000 when opening a window. Obviously you would
prefer to use the constant name instead of the number... which is what I'd like
to see for gadgets. That's all I'm trying to get across.

As for your comment about assigning constants at runtime: that's not what I mean.
The compiler can very easily create a value for a found constant during compilation.

Anyway, it was just an idea -- and that's what these forums are for: to discuss
the product and see where it leads. I liked the idea; others don't. I can live
with that. Peace.

PB - Registered PureBasic Coder

Edited by - PB on 03 July 2002 12:14:08
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Iontichy.

Hey, can we now go back to the original thread?

I think, as Sasa mentioned, somebody with asm skills
should take a look at
http://www.movsd.com/bm.htm for the regular
expression extension of purebasic. Maybe it's not 100%
of the work to do, but if it's 80% it would be much easier
to implement than invent the wheel twice.


---------------
star traveler
Post Reply