Author Topic: Replacing text  (Read 528 times)

Clippy

  • Hero Member
  • *****
  • Posts: 16446
  • I LOVE π = 4 * ATN(1)    Use the QB64 WIKI >>>
    • Pete's Qbasic Site
    • Email
Re: Replacing text
« Reply #15 on: October 02, 2011, 06:13:11 PM »
And WHY do they NEED a depository? Because there are literally THOUSANDS OF WAYS to read a string!

QB64 has the BASICS. You can use them to make the rest...

Only post DLL LIBRARY stuff in the Library Forum. And if your code doesn't REQUIRE QB64 put it in the Qbasic Samples please.
QB64 WIKI: Main Page
Download Q-Basics Code Demo: Q-Basics.zip
Download QB64 BAT, IconAdder and VBS shortcuts: QB64BAT.zip
Download QB64 DLL files in a ZIP: Program64.zip

unseenmachine

  • Hero Member
  • *****
  • Posts: 3285
  • A fish, a fish, a fishy o!
Re: Replacing text
« Reply #16 on: October 02, 2011, 06:17:52 PM »
Quote
Only post DLL LIBRARY stuff in the Library Forum. And if your code doesn't REQUIRE QB64 put it in the Qbasic Samples please.
Agreed.

Quote
QB64 has the BASICS. You can use them to make the rest...
I wish galleon would at least add the standard C++ math functions as built in though, also i would love to have ++, --, += etc but i know that that will probally never happen.
UnseenGDK Download : http://dl.dropbox.com/u/8822351/UnseenGDK.bm
GDK Tutorial : http://dl.dropbox.com/u/8822351/UnseenGDK_Tutorial.doc
VQB02 : http://dl.dropbox.com/u/8822351/VQB02.zip

vrensul

  • Sr. Member
  • ****
  • Posts: 320
  • 44th Degree Digital Wizard of the HighBytes Order
Re: Replacing text
« Reply #17 on: October 02, 2011, 10:32:11 PM »
ok, I see.  I've always just done that myself.  Find what I need and manipulate it manually.  Reckon that's why it's never really been something i've used before; eh, call me old school.  I still think about firing up QuickC for nostalgic reasons sometimes  :)

Quote
i would love to have ++, --, += etc but i know that that will probally never happen.
Yeah me too, but it's not part of basic so we'll have to dream  :(
' With programming, you  can do anything!
DEF SEG = &HBANKACNT 'weekend starts here...
     poke checking, 1000000
DEF SEG ' quit job here.

DeeBee

  • Sr. Member
  • ****
  • Posts: 491
    • Donnelly-House
    • Email
Re: Replacing text
« Reply #18 on: October 03, 2011, 03:13:29 AM »
Yeah, I tend to do that, too.

But there are things that you can do with a regex that I wouldn't
even attempt to do "manually". Things most of us couldn't even
accomplish. That's why I sometimes write programs in JavaScript
or PHP when I want to do some hard core parsing or text manipulation
and massaging.

One of the reasons I like PHP so much is because it is so BASIC-like.
In fact, if someone separated PHP from browser output and made it
compilable and run locally without a bunch of irritation (i.e., having to
install it as a web server), I would program in that instead of QB64.

Clippy

  • Hero Member
  • *****
  • Posts: 16446
  • I LOVE π = 4 * ATN(1)    Use the QB64 WIKI >>>
    • Pete's Qbasic Site
    • Email
Re: Replacing text
« Reply #19 on: October 03, 2011, 07:36:40 AM »
Well the problem is that there are SEVERAL different ways to do the parsing following STRICT formatting RULES. It would be near IMPOSSIBLE for QB64 to use one that would be universally acceptable to all users.

You can make your own rules for the construction of the expression's format when you create it yourself. In fact that might be a good PROJECT! If somebody would like to create a parsing function using a particular format I could add it to the WIKI.
QB64 WIKI: Main Page
Download Q-Basics Code Demo: Q-Basics.zip
Download QB64 BAT, IconAdder and VBS shortcuts: QB64BAT.zip
Download QB64 DLL files in a ZIP: Program64.zip

vrensul

  • Sr. Member
  • ****
  • Posts: 320
  • 44th Degree Digital Wizard of the HighBytes Order
Re: Replacing text
« Reply #20 on: October 03, 2011, 08:52:29 AM »
I'd be willing to give it a shot.  I've got str functions all over the place.  Most are in a DLL in VB but it's wound tight with some other class functions, as well as some encryption functions too.  I could start converting just the str stuff.  I just pause at what is needed.  I can see returning links and error checking some stuff.  All that is really easy to do.  But what beyond that?  Are we talking about; implementing something SQL-ish?. 
' With programming, you  can do anything!
DEF SEG = &HBANKACNT 'weekend starts here...
     poke checking, 1000000
DEF SEG ' quit job here.

DeeBee

  • Sr. Member
  • ****
  • Posts: 491
    • Donnelly-House
    • Email
Re: Replacing text
« Reply #21 on: October 03, 2011, 09:24:45 AM »
I don't know if the last two comments were in regard to regex,
or some other sub-thread.

But it would be near-impossible to write a regex function from scratch.
(or anything resembling it that would be usable) I wouldn't even attempt
a project like that.

There is the PCRE library (C or C++), which could be made into a DLL.

I also found a Pascal implementation that I've thought about converting,
but it would be a HUGE project. (I looked for something in some flavor
of BASIC and couldn't find anything -- you would think someone would
have done one by now, somewhere)

I don't do C programming anymore, and don't do C++. But the PCRE
would probably be the easiest way to do it.
Maybe someday Galleon will add it to QB64 with some links into it.
Or, since he is a C/C++ programmer, just compile it into something
that QB64 can use as a DLL or something.

(there might be a DLL already out there somewhere that is usable)

codeguy

  • Hero Member
  • *****
  • Posts: 3555
  • what the h3ll did i name that code?
    • stuff at dkm
    • Email
Re: Replacing text
« Reply #22 on: October 06, 2011, 09:01:21 AM »
umm, i also have a StringReplace sub posted here. http://www.qb64.net/forum/index.php?topic=3064.msg43987#msg43987
http://denteddisk.forums-free.com/make-an-appointment-with-the-resident-code-guru-f34.html