World: r3wp
[Parse] Discussion of PARSE dialect
older newer | first last |
Graham 30-Jun-2008 [2593x2] | rule: [ digit copy text to newline skip ] parse stuff [ some rule ] |
digits: [ some digit ] rule: [ digits ... ] | |
amacleod 30-Jun-2008 [2595] | Graham, the digit String would be included in the copied text with this? |
Graham 30-Jun-2008 [2596x3] | nope |
because it matches digit and the cursor moves on | |
past the digit | |
amacleod 30-Jun-2008 [2599] | Right. Anyway to capture the digit? |
[unknown: 5] 30-Jun-2008 [2600] | you can always do something like set n number! |
Graham 30-Jun-2008 [2601x2] | rule: [ copy d thru digits .... ] |
He's using string parsing .. not block parsing | |
[unknown: 5] 30-Jun-2008 [2603] | yeah can't use set then. |
amacleod 30-Jun-2008 [2604] | I'll try that Graham. Thanks |
Graham 30-Jun-2008 [2605x3] | or |
non-digits: complement digit parse [ copy digit-text to non-digits copy text to newline skip ] | |
and correct syntax helps :) | |
[unknown: 5] 30-Jun-2008 [2608x2] | >> str: "193920347REBOL ROCKS!^/" == "193920347REBOL ROCKS!^/" >> parse str compose [some (charset "0123456789") text: copy text thru newline] == true >> text == "REBOL ROCKS!^/" |
Something like that? | |
Brock 30-Jun-2008 [2610] | he was looking for the number and the string though. |
amacleod 30-Jun-2008 [2611x2] | No I have a text document with section numbers in front: 2. Hello 2.1 Hello Again 2.1.1 Hello already 3. Goodbye I want the section number inclued in hte copy |
It need not be included in hte same copy just as long as I can record it. | |
[unknown: 5] 30-Jun-2008 [2613] | So you just want each line then really? |
amacleod 30-Jun-2008 [2614x2] | Well it gets a little more complicated. some parts of the docment will be multilined. |
I thought it would be a simple thing that I was missing. I may need to re-think the formatting of the document. | |
[unknown: 5] 30-Jun-2008 [2616x2] | So even if something is multiline you would still want each line of the multiline correct? |
Or do you mean a multiline might looks something like this: 2.1 Hello Goodbye Where the second line doesn't have the preceeding number? | |
amacleod 30-Jun-2008 [2618] | Yes and formating may need to be retained |
[unknown: 5] 30-Jun-2008 [2619] | Ahhh yes that gets a bit more complicated. |
amacleod 30-Jun-2008 [2620] | Paul, while you are there... I was considering using Tretbase for this project |
[unknown: 5] 30-Jun-2008 [2621] | Excellent choise ;-) |
amacleod 30-Jun-2008 [2622] | Let me briefly explain where I'm going to see if you think its workable or perhaps a there is a better solution |
[unknown: 5] 30-Jun-2008 [2623] | k |
amacleod 30-Jun-2008 [2624x5] | I trying to put a set of Fire department related materials online. THey are now in pdf |
I'm converting them to text and reformatting them to parse | |
I want to hold each section in a seperate database record | |
So I can index for keywords and search and read only thse sections I need. | |
Photos and diagrams will also be stored. | |
[unknown: 5] 30-Jun-2008 [2629x4] | Well, TRETBASE 1.0 is the only finished product right now. So the only available TRETBASE app is 1.0 which is really not a multi-user solution. |
It might work for you if you not in need of multi-user (simultaenous access) | |
The next version of TRETBASE which is in work is multi-user and supports indexing. | |
But not finished. | |
amacleod 30-Jun-2008 [2633] | I'm using mysql for the online component but I need a local storage method too for offline use |
[unknown: 5] 30-Jun-2008 [2634] | It might work for that. Can also do the images conversion for you in REBOL format which is nice. |
amacleod 30-Jun-2008 [2635x2] | That was one of the things that had me thinking of using it. |
What I would need is a simple method to sync them | |
[unknown: 5] 30-Jun-2008 [2637] | Best thing to do is try it out as it really takes very little time to setup and try and you will know probably if it is suitable for you in about 10 minutes. |
amacleod 18-Jul-2008 [2638] | Is there a difference between a "space" and a "tab"? Can you parse for tab and not sapce? |
Graham 18-Jul-2008 [2639x2] | I would think you would have to parse/all .. and a space is #" " and a tab is #"^-" |
or you can use charsets | |
amacleod 18-Jul-2008 [2641] | Parse/all...works thanks |
Henrik 18-Jul-2008 [2642] | amacleod, small tip: |
older newer | first last |