RegEx Help - generating ULs from text

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

RegEx Help - generating ULs from text

Jon Harris
Hi List

I am a looking for a quick way of converting blocks of text to <ul>, using regex.

The text will look something like this:

---------------
Var('mytext') = "
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum

+ item one
+ item two
+ item three

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum" ;

--------------

So, the list starts with a line beginning with a "+" and has a single new-line, at the end. Each element has the same structure. The last item in the list starts with a "+" and has two new lines. There could be any number of elements in the list, but it will always be formatted as above. The bullet points will only be a single line of text (typically just five or six words).

I would like a series of (three?) String_ReplaceRegExp() which makes it into this:

------------------
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum

<ul>
<li>item one</li>
<li>item two</li>
<li>item three</li>
</ul>

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum

----------------

Is this possible? I am struggling with getting anything working as I keep hitting "PCRE compilation failed" errors.

I was thinking perhaps I need symbols at the beginning and end of the list. Something like:

*
+ item one
+ item two
+ item three
/*

Any help appreciated.

Regards
jon

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: RegEx Help - generating ULs from text

Jolle Carlestam-2
8 juni 2016 kl. 14:33 skrev Jon Harris <[hidden email]>:
>
> I am a looking for a quick way of converting blocks of text to <ul>, using regex.

Lasso 8 or 9?

HDB
Jolle

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

RE: RegEx Help - generating ULs from text

Jon Harris
Sorry. I meant to add [LP8.6] in my subject.


-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Jolle Carlestam
Sent: 08 June 2016 13:36
To: [hidden email]
Subject: Re: RegEx Help - generating ULs from text

8 juni 2016 kl. 14:33 skrev Jon Harris <[hidden email]>:
>
> I am a looking for a quick way of converting blocks of text to <ul>, using regex.

Lasso 8 or 9?

HDB
Jolle

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email] Official list archives available at http://www.lassotalk.com To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

RE: RegEx Help - generating ULs from text

Jon Harris
I think I might have got it working:

var('newString') = String_ReplaceRegExp(var('theString'),-find="\n\s?\\+\s?(.*)",-replace="<ul><li>\\1</li></ul>");



-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Jon Harris
Sent: 08 June 2016 13:45
To: [hidden email]
Subject: RE: RegEx Help - generating ULs from text

Sorry. I meant to add [LP8.6] in my subject.


-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Jolle Carlestam
Sent: 08 June 2016 13:36
To: [hidden email]
Subject: Re: RegEx Help - generating ULs from text

8 juni 2016 kl. 14:33 skrev Jon Harris <[hidden email]>:
>
> I am a looking for a quick way of converting blocks of text to <ul>, using regex.

Lasso 8 or 9?

HDB
Jolle

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email] Official list archives available at http://www.lassotalk.com To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email] Official list archives available at http://www.lassotalk.com To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

RE: RegEx Help - generating ULs from text

Jon Harris
Actually, that didn't work. It creates separate ULs for each line.

... back to the drawing board.


-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Jon Harris
Sent: 08 June 2016 14:02
To: [hidden email]
Subject: RE: RegEx Help - generating ULs from text

I think I might have got it working:

var('newString') = String_ReplaceRegExp(var('theString'),-find="\n\s?\\+\s?(.*)",-replace="<ul><li>\\1</li></ul>");



-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Jon Harris
Sent: 08 June 2016 13:45
To: [hidden email]
Subject: RE: RegEx Help - generating ULs from text

Sorry. I meant to add [LP8.6] in my subject.


-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Jolle Carlestam
Sent: 08 June 2016 13:36
To: [hidden email]
Subject: Re: RegEx Help - generating ULs from text

8 juni 2016 kl. 14:33 skrev Jon Harris <[hidden email]>:
>
> I am a looking for a quick way of converting blocks of text to <ul>, using regex.

Lasso 8 or 9?

HDB
Jolle

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email] Official list archives available at http://www.lassotalk.com To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email] Official list archives available at http://www.lassotalk.com To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email] Official list archives available at http://www.lassotalk.com To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: RegEx Help - generating ULs from text

French, Shelane
There was a set of tags written by Fletcher for encoding and decoding
"LassoWiki" text which included bullets. I have the code. I was trying to
find it on LassoSoft as it was once part of the tip of the week series.
If I can't find it, I can post it on tag swap, though I take no credit for
it myself.



Shelane French
Workforce Enablement
Livermore Information Technology




On 6/8/16, 6:06 AM, "[hidden email] on behalf of Jon
Harris" <[hidden email] on behalf of
[hidden email]> wrote:

>Actually, that didn't work. It creates separate ULs for each line.
>
>... back to the drawing board.
>
>
>-----Original Message-----
>From: [hidden email]
>[mailto:[hidden email]] On Behalf Of Jon Harris
>Sent: 08 June 2016 14:02
>To: [hidden email]
>Subject: RE: RegEx Help - generating ULs from text
>
>I think I might have got it working:
>
>var('newString') =
>String_ReplaceRegExp(var('theString'),-find="\n\s?\\+\s?(.*)",-replace="<u
>l><li>\\1</li></ul>");
>
>
>
>-----Original Message-----
>From: [hidden email]
>[mailto:[hidden email]] On Behalf Of Jon Harris
>Sent: 08 June 2016 13:45
>To: [hidden email]
>Subject: RE: RegEx Help - generating ULs from text
>
>Sorry. I meant to add [LP8.6] in my subject.
>
>
>-----Original Message-----
>From: [hidden email]
>[mailto:[hidden email]] On Behalf Of Jolle Carlestam
>Sent: 08 June 2016 13:36
>To: [hidden email]
>Subject: Re: RegEx Help - generating ULs from text
>
>8 juni 2016 kl. 14:33 skrev Jon Harris <[hidden email]>:
>>
>> I am a looking for a quick way of converting blocks of text to <ul>,
>>using regex.
>
>Lasso 8 or 9?
>
>HDB
>Jolle
>
>#############################################################
>
>This message is sent to you because you are subscribed to
>  the mailing list Lasso [hidden email] Official list archives
>available at http://www.lassotalk.com To unsubscribe, E-mail to:
><[hidden email]>
>Send administrative queries to  <[hidden email]>
>
>#############################################################
>
>This message is sent to you because you are subscribed to
>  the mailing list Lasso [hidden email] Official list archives
>available at http://www.lassotalk.com To unsubscribe, E-mail to:
><[hidden email]>
>Send administrative queries to  <[hidden email]>
>
>#############################################################
>
>This message is sent to you because you are subscribed to
>  the mailing list Lasso [hidden email] Official list archives
>available at http://www.lassotalk.com To unsubscribe, E-mail to:
><[hidden email]>
>Send administrative queries to  <[hidden email]>
>
>#############################################################
>
>This message is sent to you because you are subscribed to
>  the mailing list Lasso [hidden email]
>Official list archives available at http://www.lassotalk.com
>To unsubscribe, E-mail to: <[hidden email]>
>Send administrative queries to  <[hidden email]>


#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

RE: RegEx Help - generating ULs from text

Jon Harris
Hi Shelane

Yes please.  I'm still stuck on this.

Regards
Jon

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of French, Shelane
Sent: 08 June 2016 16:25
To: [hidden email]
Subject: Re: RegEx Help - generating ULs from text

There was a set of tags written by Fletcher for encoding and decoding "LassoWiki" text which included bullets. I have the code. I was trying to find it on LassoSoft as it was once part of the tip of the week series.
If I can't find it, I can post it on tag swap, though I take no credit for it myself.



Shelane French
Workforce Enablement
Livermore Information Technology




On 6/8/16, 6:06 AM, "[hidden email] on behalf of Jon Harris" <[hidden email] on behalf of [hidden email]> wrote:

>Actually, that didn't work. It creates separate ULs for each line.
>
>... back to the drawing board.
>
>
>-----Original Message-----
>From: [hidden email]
>[mailto:[hidden email]] On Behalf Of Jon Harris
>Sent: 08 June 2016 14:02
>To: [hidden email]
>Subject: RE: RegEx Help - generating ULs from text
>
>I think I might have got it working:
>
>var('newString') =
>String_ReplaceRegExp(var('theString'),-find="\n\s?\\+\s?(.*)",-replace=
>"<u
>l><li>\\1</li></ul>");
>
>
>
>-----Original Message-----
>From: [hidden email]
>[mailto:[hidden email]] On Behalf Of Jon Harris
>Sent: 08 June 2016 13:45
>To: [hidden email]
>Subject: RE: RegEx Help - generating ULs from text
>
>Sorry. I meant to add [LP8.6] in my subject.
>
>
>-----Original Message-----
>From: [hidden email]
>[mailto:[hidden email]] On Behalf Of Jolle Carlestam
>Sent: 08 June 2016 13:36
>To: [hidden email]
>Subject: Re: RegEx Help - generating ULs from text
>
>8 juni 2016 kl. 14:33 skrev Jon Harris <[hidden email]>:
>>
>> I am a looking for a quick way of converting blocks of text to <ul>,
>>using regex.
>
>Lasso 8 or 9?
>
>HDB
>Jolle
>
>#############################################################
>
>This message is sent to you because you are subscribed to
>  the mailing list Lasso [hidden email] Official list
>archives available at http://www.lassotalk.com To unsubscribe, E-mail to:
><[hidden email]>
>Send administrative queries to  <[hidden email]>
>
>#############################################################
>
>This message is sent to you because you are subscribed to
>  the mailing list Lasso [hidden email] Official list
>archives available at http://www.lassotalk.com To unsubscribe, E-mail to:
><[hidden email]>
>Send administrative queries to  <[hidden email]>
>
>#############################################################
>
>This message is sent to you because you are subscribed to
>  the mailing list Lasso [hidden email] Official list
>archives available at http://www.lassotalk.com To unsubscribe, E-mail to:
><[hidden email]>
>Send administrative queries to  <[hidden email]>
>
>#############################################################
>
>This message is sent to you because you are subscribed to
>  the mailing list Lasso [hidden email] Official list
>archives available at http://www.lassotalk.com To unsubscribe, E-mail
>to: <[hidden email]>
>Send administrative queries to  <[hidden email]>


#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email] Official list archives available at http://www.lassotalk.com To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: RegEx Help - generating ULs from text

French, Shelane
Found something that describes it:

http://www.lassosoft.com/Regular-Expression-Challenge-Wiki-Style-Formatting

It uses old colon syntax, but that still works in 8.6, though not ideal.





Shelane French
Workforce Enablement
Livermore Information Technology




On 6/8/16, 8:28 AM, "[hidden email] on behalf of Jon
Harris" <[hidden email] on behalf of
[hidden email]> wrote:

>Hi Shelane
>
>Yes please.  I'm still stuck on this.
>
>Regards
>Jon
>
>-----Original Message-----
>From: [hidden email]
>[mailto:[hidden email]] On Behalf Of French, Shelane
>Sent: 08 June 2016 16:25
>To: [hidden email]
>Subject: Re: RegEx Help - generating ULs from text
>
>There was a set of tags written by Fletcher for encoding and decoding
>"LassoWiki" text which included bullets. I have the code. I was trying to
>find it on LassoSoft as it was once part of the tip of the week series.
>If I can't find it, I can post it on tag swap, though I take no credit
>for it myself.
>
>
>
>Shelane French
>Workforce Enablement
>Livermore Information Technology
>
>
>
>
>On 6/8/16, 6:06 AM, "[hidden email] on behalf of Jon
>Harris" <[hidden email] on behalf of
>[hidden email]> wrote:
>
>>Actually, that didn't work. It creates separate ULs for each line.
>>
>>... back to the drawing board.
>>
>>
>>-----Original Message-----
>>From: [hidden email]
>>[mailto:[hidden email]] On Behalf Of Jon Harris
>>Sent: 08 June 2016 14:02
>>To: [hidden email]
>>Subject: RE: RegEx Help - generating ULs from text
>>
>>I think I might have got it working:
>>
>>var('newString') =
>>String_ReplaceRegExp(var('theString'),-find="\n\s?\\+\s?(.*)",-replace=
>>"<u
>>l><li>\\1</li></ul>");
>>
>>
>>
>>-----Original Message-----
>>From: [hidden email]
>>[mailto:[hidden email]] On Behalf Of Jon Harris
>>Sent: 08 June 2016 13:45
>>To: [hidden email]
>>Subject: RE: RegEx Help - generating ULs from text
>>
>>Sorry. I meant to add [LP8.6] in my subject.
>>
>>
>>-----Original Message-----
>>From: [hidden email]
>>[mailto:[hidden email]] On Behalf Of Jolle Carlestam
>>Sent: 08 June 2016 13:36
>>To: [hidden email]
>>Subject: Re: RegEx Help - generating ULs from text
>>
>>8 juni 2016 kl. 14:33 skrev Jon Harris <[hidden email]>:
>>>
>>> I am a looking for a quick way of converting blocks of text to <ul>,
>>>using regex.
>>
>>Lasso 8 or 9?
>>
>>HDB
>>Jolle
>>
>>#############################################################
>>
>>This message is sent to you because you are subscribed to
>>  the mailing list Lasso [hidden email] Official list
>>archives available at http://www.lassotalk.com To unsubscribe, E-mail to:
>><[hidden email]>
>>Send administrative queries to  <[hidden email]>
>>
>>#############################################################
>>
>>This message is sent to you because you are subscribed to
>>  the mailing list Lasso [hidden email] Official list
>>archives available at http://www.lassotalk.com To unsubscribe, E-mail to:
>><[hidden email]>
>>Send administrative queries to  <[hidden email]>
>>
>>#############################################################
>>
>>This message is sent to you because you are subscribed to
>>  the mailing list Lasso [hidden email] Official list
>>archives available at http://www.lassotalk.com To unsubscribe, E-mail to:
>><[hidden email]>
>>Send administrative queries to  <[hidden email]>
>>
>>#############################################################
>>
>>This message is sent to you because you are subscribed to
>>  the mailing list Lasso [hidden email] Official list
>>archives available at http://www.lassotalk.com To unsubscribe, E-mail
>>to: <[hidden email]>
>>Send administrative queries to  <[hidden email]>
>
>
>#############################################################
>
>This message is sent to you because you are subscribed to
>  the mailing list Lasso [hidden email] Official list archives
>available at http://www.lassotalk.com To unsubscribe, E-mail to:
><[hidden email]>
>Send administrative queries to  <[hidden email]>
>
>#############################################################
>
>This message is sent to you because you are subscribed to
>  the mailing list Lasso [hidden email]
>Official list archives available at http://www.lassotalk.com
>To unsubscribe, E-mail to: <[hidden email]>
>Send administrative queries to  <[hidden email]>


#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: RegEx Help - generating ULs from text

jasonhuck
I would recommend using an existing, documented, and maintained tool that
converts plain text markup into HTML. Have a look at reStructuredText:

http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html

If you install the docutils package you can probably call rst2html via
os_process.

- jason



On Wed, Jun 8, 2016 at 11:29 AM, French, Shelane <[hidden email]> wrote:

> Found something that describes it:
>
> http://www.lassosoft.com/Regular-Expression-Challenge-Wiki-Style-Formatting
>
> It uses old colon syntax, but that still works in 8.6, though not ideal.
>
>
>
>
>
> Shelane French
> Workforce Enablement
> Livermore Information Technology
>
>
>
>
> On 6/8/16, 8:28 AM, "[hidden email] on behalf of Jon
> Harris" <[hidden email] on behalf of
> [hidden email]> wrote:
>
> >Hi Shelane
> >
> >Yes please.  I'm still stuck on this.
> >
> >Regards
> >Jon
> >
> >-----Original Message-----
> >From: [hidden email]
> >[mailto:[hidden email]] On Behalf Of French, Shelane
> >Sent: 08 June 2016 16:25
> >To: [hidden email]
> >Subject: Re: RegEx Help - generating ULs from text
> >
> >There was a set of tags written by Fletcher for encoding and decoding
> >"LassoWiki" text which included bullets. I have the code. I was trying to
> >find it on LassoSoft as it was once part of the tip of the week series.
> >If I can't find it, I can post it on tag swap, though I take no credit
> >for it myself.
> >
> >
> >
> >Shelane French
> >Workforce Enablement
> >Livermore Information Technology
> >
> >
> >
> >
> >On 6/8/16, 6:06 AM, "[hidden email] on behalf of Jon
> >Harris" <[hidden email] on behalf of
> >[hidden email]> wrote:
> >
> >>Actually, that didn't work. It creates separate ULs for each line.
> >>
> >>... back to the drawing board.
> >>
> >>
> >>-----Original Message-----
> >>From: [hidden email]
> >>[mailto:[hidden email]] On Behalf Of Jon Harris
> >>Sent: 08 June 2016 14:02
> >>To: [hidden email]
> >>Subject: RE: RegEx Help - generating ULs from text
> >>
> >>I think I might have got it working:
> >>
> >>var('newString') =
> >>String_ReplaceRegExp(var('theString'),-find="\n\s?\\+\s?(.*)",-replace=
> >>"<u
> >>l><li>\\1</li></ul>");
> >>
> >>
> >>
> >>-----Original Message-----
> >>From: [hidden email]
> >>[mailto:[hidden email]] On Behalf Of Jon Harris
> >>Sent: 08 June 2016 13:45
> >>To: [hidden email]
> >>Subject: RE: RegEx Help - generating ULs from text
> >>
> >>Sorry. I meant to add [LP8.6] in my subject.
> >>
> >>
> >>-----Original Message-----
> >>From: [hidden email]
> >>[mailto:[hidden email]] On Behalf Of Jolle Carlestam
> >>Sent: 08 June 2016 13:36
> >>To: [hidden email]
> >>Subject: Re: RegEx Help - generating ULs from text
> >>
> >>8 juni 2016 kl. 14:33 skrev Jon Harris <[hidden email]>:
> >>>
> >>> I am a looking for a quick way of converting blocks of text to <ul>,
> >>>using regex.
> >>
> >>Lasso 8 or 9?
> >>
> >>HDB
> >>Jolle
> >>
> >>#############################################################
> >>
> >>This message is sent to you because you are subscribed to
> >>  the mailing list Lasso [hidden email] Official list
> >>archives available at http://www.lassotalk.com To unsubscribe, E-mail
> to:
> >><[hidden email]>
> >>Send administrative queries to  <[hidden email]>
> >>
> >>#############################################################
> >>
> >>This message is sent to you because you are subscribed to
> >>  the mailing list Lasso [hidden email] Official list
> >>archives available at http://www.lassotalk.com To unsubscribe, E-mail
> to:
> >><[hidden email]>
> >>Send administrative queries to  <[hidden email]>
> >>
> >>#############################################################
> >>
> >>This message is sent to you because you are subscribed to
> >>  the mailing list Lasso [hidden email] Official list
> >>archives available at http://www.lassotalk.com To unsubscribe, E-mail
> to:
> >><[hidden email]>
> >>Send administrative queries to  <[hidden email]>
> >>
> >>#############################################################
> >>
> >>This message is sent to you because you are subscribed to
> >>  the mailing list Lasso [hidden email] Official list
> >>archives available at http://www.lassotalk.com To unsubscribe, E-mail
> >>to: <[hidden email]>
> >>Send administrative queries to  <[hidden email]>
> >
> >
> >#############################################################
> >
> >This message is sent to you because you are subscribed to
> >  the mailing list Lasso [hidden email] Official list archives
> >available at http://www.lassotalk.com To unsubscribe, E-mail to:
> ><[hidden email]>
> >Send administrative queries to  <[hidden email]>
> >
> >#############################################################
> >
> >This message is sent to you because you are subscribed to
> >  the mailing list Lasso [hidden email]
> >Official list archives available at http://www.lassotalk.com
> >To unsubscribe, E-mail to: <[hidden email]>
> >Send administrative queries to  <[hidden email]>
>
>
> #############################################################
>
> This message is sent to you because you are subscribed to
>   the mailing list Lasso [hidden email]
> Official list archives available at http://www.lassotalk.com
> To unsubscribe, E-mail to: <[hidden email]>
> Send administrative queries to  <[hidden email]>
>

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: RegEx Help - generating ULs from text

stevepiercy
Aw, c'mon, it's more fun to reinvent the wheel.  :P

Seriously, docutils and Python FTW!

IMO reStructuredText is the best markup language for writing
documentation and content.  It's better than markdown and others
because it automatically generates links between pages, modules,
indices, and libraries.

Add Sphinx to theme or skin your docs into multi-page
feature-rich websites, PDFs, epubs, or just text.
http://www.sphinx-doc.org/en/stable/

It was at my incessant urging that LassoSoft used .rst for:
http://lassoguide.com/

I use it almost daily for my open source contributions to
Pyramid documentation.
http://docs.pylonsproject.org/projects/pyramid/en/latest/

And I use .rst through Pelican to generate my own static website
with live Lasso demos.
http://www.stevepiercy.com/articles/refreshing-responsive-redesign-with-pelican-and-zurb-foundation/

--steve


On 6/8/16 at 11:39 AM, [hidden email] (Jason Huck) pronounced:

>I would recommend using an existing, documented, and maintained tool that
>converts plain text markup into HTML. Have a look at reStructuredText:
>
>http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html
>
>If you install the docutils package you can probably call rst2html via
>os_process.
>
>- jason
>
>
>
>On Wed, Jun 8, 2016 at 11:29 AM, French, Shelane <[hidden email]> wrote:
>
>>Found something that describes it:
>>
>>http://www.lassosoft.com/Regular-Expression-Challenge-Wiki-Style-Formatting
>>
>>It uses old colon syntax, but that still works in 8.6, though not ideal.
>>
>>
>>
>>
>>
>>Shelane French
>>Workforce Enablement
>>Livermore Information Technology
>>
>>
>>
>>
>>On 6/8/16, 8:28 AM, "[hidden email] on behalf of Jon
>>Harris" <[hidden email] on behalf of
>>[hidden email]> wrote:
>>
>>>Hi Shelane
>>>
>>>Yes please.  I'm still stuck on this.
>>>
>>>Regards
>>>Jon
>>>
>>>-----Original Message-----
>>>From: [hidden email]
>>>[mailto:[hidden email]] On Behalf Of French, Shelane
>>>Sent: 08 June 2016 16:25
>>>To: [hidden email]
>>>Subject: Re: RegEx Help - generating ULs from text
>>>
>>>There was a set of tags written by Fletcher for encoding and decoding
>>>"LassoWiki" text which included bullets. I have the code. I was trying to
>>>find it on LassoSoft as it was once part of the tip of the week series.
>>>If I can't find it, I can post it on tag swap, though I take no credit
>>>for it myself.
>>>
>>>
>>>
>>>Shelane French
>>>Workforce Enablement
>>>Livermore Information Technology
>>>
>>>
>>>
>>>
>>>On 6/8/16, 6:06 AM, "[hidden email] on behalf of Jon
>>>Harris" <[hidden email] on behalf of
>>>[hidden email]> wrote:
>>>
>>>>Actually, that didn't work. It creates separate ULs for each line.
>>>>
>>>>... back to the drawing board.
>>>>
>>>>
>>>>-----Original Message-----
>>>>From: [hidden email]
>>>>[mailto:[hidden email]] On Behalf Of Jon Harris
>>>>Sent: 08 June 2016 14:02
>>>>To: [hidden email]
>>>>Subject: RE: RegEx Help - generating ULs from text
>>>>
>>>>I think I might have got it working:
>>>>
>>>>var('newString') =
>>>>String_ReplaceRegExp(var('theString'),-find="\n\s?\\+\s?(.*)",-replace=
>>>>"<u
>>>>l><li>\\1</li></ul>");
>>>>
>>>>
>>>>
>>>>-----Original Message-----
>>>>From: [hidden email]
>>>>[mailto:[hidden email]] On Behalf Of Jon Harris
>>>>Sent: 08 June 2016 13:45
>>>>To: [hidden email]
>>>>Subject: RE: RegEx Help - generating ULs from text
>>>>
>>>>Sorry. I meant to add [LP8.6] in my subject.
>>>>
>>>>
>>>>-----Original Message-----
>>>>From: [hidden email]
>>>>[mailto:[hidden email]] On Behalf Of Jolle Carlestam
>>>>Sent: 08 June 2016 13:36
>>>>To: [hidden email]
>>>>Subject: Re: RegEx Help - generating ULs from text
>>>>
>>>>8 juni 2016 kl. 14:33 skrev Jon Harris <[hidden email]>:
>>>>>
>>>>> I am a looking for a quick way of converting blocks of text to <ul>,
>>>>>using regex.
>>>>
>>>>Lasso 8 or 9?
>>>>
>>>>HDB
>>>>Jolle
>>>>
>>>>#############################################################
>>>>
>>>>This message is sent to you because you are subscribed to
>>>>  the mailing list Lasso [hidden email] Official list
>>>>archives available at http://www.lassotalk.com To unsubscribe, E-mail
>>to:
>>>><[hidden email]>
>>>>Send administrative queries to  <[hidden email]>
>>>>
>>>>#############################################################
>>>>
>>>>This message is sent to you because you are subscribed to
>>>>  the mailing list Lasso [hidden email] Official list
>>>>archives available at http://www.lassotalk.com To unsubscribe, E-mail
>>to:
>>>><[hidden email]>
>>>>Send administrative queries to  <[hidden email]>
>>>>
>>>>#############################################################
>>>>
>>>>This message is sent to you because you are subscribed to
>>>>  the mailing list Lasso [hidden email] Official list
>>>>archives available at http://www.lassotalk.com To unsubscribe, E-mail
>>to:
>>>><[hidden email]>
>>>>Send administrative queries to  <[hidden email]>
>>>>
>>>>#############################################################
>>>>
>>>>This message is sent to you because you are subscribed to
>>>>  the mailing list Lasso [hidden email] Official list
>>>>archives available at http://www.lassotalk.com To unsubscribe, E-mail
>>>>to: <[hidden email]>
>>>>Send administrative queries to  <[hidden email]>
>>>
>>>
>>>#############################################################
>>>
>>>This message is sent to you because you are subscribed to
>>>the mailing list Lasso [hidden email] Official list archives
>>>available at http://www.lassotalk.com To unsubscribe, E-mail to:
>>><[hidden email]>
>>>Send administrative queries to  <[hidden email]>
>>>
>>>#############################################################
>>>
>>>This message is sent to you because you are subscribed to
>>>the mailing list Lasso [hidden email]
>>>Official list archives available at http://www.lassotalk.com
>>>To unsubscribe, E-mail to: <[hidden email]>
>>>Send administrative queries to  <[hidden email]>
>>
>>
>>#############################################################
>>
>>This message is sent to you because you are subscribed to
>>the mailing list Lasso [hidden email]
>>Official list archives available at http://www.lassotalk.com
>>To unsubscribe, E-mail to: <[hidden email]>
>>Send administrative queries to  <[hidden email]>
>>
>
>#############################################################
>
>This message is sent to you because you are subscribed to
>the mailing list Lasso [hidden email]
>Official list archives available at http://www.lassotalk.com
>To unsubscribe, E-mail to: <[hidden email]>
>Send administrative queries to  <[hidden email]>

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Steve Piercy              Website Builder              Soquel, CA
<[hidden email]>               <http://www.stevepiercy.com/>


#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: RegEx Help - generating ULs from text

Bil Corry-3
Here's one way to do it, if you're going to roll your own...

- Bil

[

var('mytext') = "
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
est laborum

  + item one
+ item two
 + item three

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
est laborum

 + another item
+ yet another
   + good times
 + test 123

Wheeeee!

";

var('out') =
string_replaceregexp($mytext,-find="(\\s*\\+\\s*)([^\r\n]+)",-replace="<li>\\2</li>");
$out =
string_replaceregexp($out,-find="</li>(?!(<li>))",-replace="</li></ul>");
$out =
string_replaceregexp($out,-find="(?<!</li>)<li>",-replace="<ul><li>");

$out;

]



On Wed, Jun 8, 2016 at 8:09 PM, Steve Piercy - Website Builder <
[hidden email]> wrote:

> Aw, c'mon, it's more fun to reinvent the wheel.  :P
>
> Seriously, docutils and Python FTW!
>
> IMO reStructuredText is the best markup language for writing documentation
> and content.  It's better than markdown and others because it automatically
> generates links between pages, modules, indices, and libraries.
>
> Add Sphinx to theme or skin your docs into multi-page feature-rich
> websites, PDFs, epubs, or just text.
> http://www.sphinx-doc.org/en/stable/
>
> It was at my incessant urging that LassoSoft used .rst for:
> http://lassoguide.com/
>
> I use it almost daily for my open source contributions to Pyramid
> documentation.
> http://docs.pylonsproject.org/projects/pyramid/en/latest/
>
> And I use .rst through Pelican to generate my own static website with live
> Lasso demos.
>
> http://www.stevepiercy.com/articles/refreshing-responsive-redesign-with-pelican-and-zurb-foundation/
>
> --steve
>
>
> On 6/8/16 at 11:39 AM, [hidden email] (Jason Huck) pronounced:
>
>
> I would recommend using an existing, documented, and maintained tool that
>> converts plain text markup into HTML. Have a look at reStructuredText:
>>
>> http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html
>>
>> If you install the docutils package you can probably call rst2html via
>> os_process.
>>
>> - jason
>>
>>
>>
>> On Wed, Jun 8, 2016 at 11:29 AM, French, Shelane <[hidden email]>
>> wrote:
>>
>> Found something that describes it:
>>>
>>>
>>> http://www.lassosoft.com/Regular-Expression-Challenge-Wiki-Style-Formatting
>>>
>>> It uses old colon syntax, but that still works in 8.6, though not ideal.
>>>
>>>
>>>
>>>
>>>
>>> Shelane French
>>> Workforce Enablement
>>> Livermore Information Technology
>>>
>>>
>>>
>>>
>>> On 6/8/16, 8:28 AM, "[hidden email] on behalf of Jon
>>> Harris" <[hidden email] on behalf of
>>> [hidden email]> wrote:
>>>
>>> Hi Shelane
>>>>
>>>> Yes please.  I'm still stuck on this.
>>>>
>>>> Regards
>>>> Jon
>>>>
>>>> -----Original Message-----
>>>> From: [hidden email]
>>>> [mailto:[hidden email]] On Behalf Of French, Shelane
>>>> Sent: 08 June 2016 16:25
>>>> To: [hidden email]
>>>> Subject: Re: RegEx Help - generating ULs from text
>>>>
>>>> There was a set of tags written by Fletcher for encoding and decoding
>>>> "LassoWiki" text which included bullets. I have the code. I was trying
>>>> to
>>>> find it on LassoSoft as it was once part of the tip of the week series.
>>>> If I can't find it, I can post it on tag swap, though I take no credit
>>>> for it myself.
>>>>
>>>>
>>>>
>>>> Shelane French
>>>> Workforce Enablement
>>>> Livermore Information Technology
>>>>
>>>>
>>>>
>>>>
>>>> On 6/8/16, 6:06 AM, "[hidden email] on behalf of Jon
>>>> Harris" <[hidden email] on behalf of
>>>> [hidden email]> wrote:
>>>>
>>>> Actually, that didn't work. It creates separate ULs for each line.
>>>>>
>>>>> ... back to the drawing board.
>>>>>
>>>>>
>>>>> -----Original Message-----
>>>>> From: [hidden email]
>>>>> [mailto:[hidden email]] On Behalf Of Jon Harris
>>>>> Sent: 08 June 2016 14:02
>>>>> To: [hidden email]
>>>>> Subject: RE: RegEx Help - generating ULs from text
>>>>>
>>>>> I think I might have got it working:
>>>>>
>>>>> var('newString') =
>>>>> String_ReplaceRegExp(var('theString'),-find="\n\s?\\+\s?(.*)",-replace=
>>>>> "<u
>>>>> l><li>\\1</li></ul>");
>>>>>
>>>>>
>>>>>
>>>>> -----Original Message-----
>>>>> From: [hidden email]
>>>>> [mailto:[hidden email]] On Behalf Of Jon Harris
>>>>> Sent: 08 June 2016 13:45
>>>>> To: [hidden email]
>>>>> Subject: RE: RegEx Help - generating ULs from text
>>>>>
>>>>> Sorry. I meant to add [LP8.6] in my subject.
>>>>>
>>>>>
>>>>> -----Original Message-----
>>>>> From: [hidden email]
>>>>> [mailto:[hidden email]] On Behalf Of Jolle
>>>>> Carlestam
>>>>> Sent: 08 June 2016 13:36
>>>>> To: [hidden email]
>>>>> Subject: Re: RegEx Help - generating ULs from text
>>>>>
>>>>> 8 juni 2016 kl. 14:33 skrev Jon Harris <[hidden email]>:
>>>>>
>>>>>>
>>>>>> I am a looking for a quick way of converting blocks of text to <ul>,
>>>>>> using regex.
>>>>>>
>>>>>
>>>>> Lasso 8 or 9?
>>>>>
>>>>> HDB
>>>>> Jolle
>>>>>
>>>>> #############################################################
>>>>>
>>>>> This message is sent to you because you are subscribed to
>>>>>  the mailing list Lasso [hidden email] Official list
>>>>> archives available at http://www.lassotalk.com To unsubscribe, E-mail
>>>>>
>>>> to:
>>>
>>>> <[hidden email]>
>>>>> Send administrative queries to  <[hidden email]>
>>>>>
>>>>> #############################################################
>>>>>
>>>>> This message is sent to you because you are subscribed to
>>>>>  the mailing list Lasso [hidden email] Official list
>>>>> archives available at http://www.lassotalk.com To unsubscribe, E-mail
>>>>>
>>>> to:
>>>
>>>> <[hidden email]>
>>>>> Send administrative queries to  <[hidden email]>
>>>>>
>>>>> #############################################################
>>>>>
>>>>> This message is sent to you because you are subscribed to
>>>>>  the mailing list Lasso [hidden email] Official list
>>>>> archives available at http://www.lassotalk.com To unsubscribe, E-mail
>>>>>
>>>> to:
>>>
>>>> <[hidden email]>
>>>>> Send administrative queries to  <[hidden email]>
>>>>>
>>>>> #############################################################
>>>>>
>>>>> This message is sent to you because you are subscribed to
>>>>>  the mailing list Lasso [hidden email] Official list
>>>>> archives available at http://www.lassotalk.com To unsubscribe, E-mail
>>>>> to: <[hidden email]>
>>>>> Send administrative queries to  <[hidden email]>
>>>>>
>>>>
>>>>
>>>> #############################################################
>>>>
>>>> This message is sent to you because you are subscribed to
>>>> the mailing list Lasso [hidden email] Official list archives
>>>> available at http://www.lassotalk.com To unsubscribe, E-mail to:
>>>> <[hidden email]>
>>>> Send administrative queries to  <[hidden email]>
>>>>
>>>> #############################################################
>>>>
>>>> This message is sent to you because you are subscribed to
>>>> the mailing list Lasso [hidden email]
>>>> Official list archives available at http://www.lassotalk.com
>>>> To unsubscribe, E-mail to: <[hidden email]>
>>>> Send administrative queries to  <[hidden email]>
>>>>
>>>
>>>
>>> #############################################################
>>>
>>> This message is sent to you because you are subscribed to
>>> the mailing list Lasso [hidden email]
>>> Official list archives available at http://www.lassotalk.com
>>> To unsubscribe, E-mail to: <[hidden email]>
>>> Send administrative queries to  <[hidden email]>
>>>
>>>
>> #############################################################
>>
>> This message is sent to you because you are subscribed to
>> the mailing list Lasso [hidden email]
>> Official list archives available at http://www.lassotalk.com
>> To unsubscribe, E-mail to: <[hidden email]>
>> Send administrative queries to  <[hidden email]>
>>
>
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> Steve Piercy              Website Builder              Soquel, CA
> <[hidden email]>               <http://www.stevepiercy.com/>
>
>
>
> #############################################################
>
> This message is sent to you because you are subscribed to
>  the mailing list Lasso [hidden email]
> Official list archives available at http://www.lassotalk.com
> To unsubscribe, E-mail to: <[hidden email]>
> Send administrative queries to  <[hidden email]>
>

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

RE: RegEx Help - generating ULs from text

Jon Harris
Hi Bill

Many thanks to you, Steve, Jason and Shelane.

I have munged some of Fletcher's "lassowiki" tags into a "listfinder" tag, so I have got a solution. However, your code is much more compact, so I have made it into a tag, and added it to our tag library.

This has exposed my limit knowledge and understanding of regex. I have now looking at getting the boldly named:
"Teach Yourself Regular Expressions in 10 Minutes" book. So by tomorrow I should be an expert :-)

- Unless anyone has any alternative suggestions. I would love to find a Lasso specific tutorial, which includes things like "matchstring", and the "regexp" command itself.

Regards
Jon


-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Bil Corry
Sent: 08 June 2016 20:21
To: [hidden email]
Subject: Re: RegEx Help - generating ULs from text

Here's one way to do it, if you're going to roll your own...

- Bil

[

var('mytext') = "
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum

  + item one
+ item two
 + item three

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum

 + another item
+ yet another
   + good times
 + test 123

Wheeeee!

";

var('out') =
string_replaceregexp($mytext,-find="(\\s*\\+\\s*)([^\r\n]+)",-replace="<li>\\2</li>");
$out =
string_replaceregexp($out,-find="</li>(?!(<li>))",-replace="</li></ul>");
$out =
string_replaceregexp($out,-find="(?<!</li>)<li>",-replace="<ul><li>");

$out;

]



On Wed, Jun 8, 2016 at 8:09 PM, Steve Piercy - Website Builder < [hidden email]> wrote:

> Aw, c'mon, it's more fun to reinvent the wheel.  :P
>
> Seriously, docutils and Python FTW!
>
> IMO reStructuredText is the best markup language for writing
> documentation and content.  It's better than markdown and others
> because it automatically generates links between pages, modules, indices, and libraries.
>
> Add Sphinx to theme or skin your docs into multi-page feature-rich
> websites, PDFs, epubs, or just text.
> http://www.sphinx-doc.org/en/stable/
>
> It was at my incessant urging that LassoSoft used .rst for:
> http://lassoguide.com/
>
> I use it almost daily for my open source contributions to Pyramid
> documentation.
> http://docs.pylonsproject.org/projects/pyramid/en/latest/
>
> And I use .rst through Pelican to generate my own static website with
> live Lasso demos.
>
> http://www.stevepiercy.com/articles/refreshing-responsive-redesign-wit
> h-pelican-and-zurb-foundation/
>
> --steve
>
>
> On 6/8/16 at 11:39 AM, [hidden email] (Jason Huck) pronounced:
>
>
> I would recommend using an existing, documented, and maintained tool
> that
>> converts plain text markup into HTML. Have a look at reStructuredText:
>>
>> http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html
>>
>> If you install the docutils package you can probably call rst2html
>> via os_process.
>>
>> - jason
>>
>>
>>
>> On Wed, Jun 8, 2016 at 11:29 AM, French, Shelane <[hidden email]>
>> wrote:
>>
>> Found something that describes it:
>>>
>>>
>>> http://www.lassosoft.com/Regular-Expression-Challenge-Wiki-Style-For
>>> matting
>>>
>>> It uses old colon syntax, but that still works in 8.6, though not ideal.
>>>
>>>
>>>
>>>
>>>
>>> Shelane French
>>> Workforce Enablement
>>> Livermore Information Technology
>>>
>>>
>>>
>>>
>>> On 6/8/16, 8:28 AM, "[hidden email] on behalf of
>>> Jon Harris" <[hidden email] on behalf of
>>> [hidden email]> wrote:
>>>
>>> Hi Shelane
>>>>
>>>> Yes please.  I'm still stuck on this.
>>>>
>>>> Regards
>>>> Jon
>>>>
>>>> -----Original Message-----
>>>> From: [hidden email]
>>>> [mailto:[hidden email]] On Behalf Of French,
>>>> Shelane
>>>> Sent: 08 June 2016 16:25
>>>> To: [hidden email]
>>>> Subject: Re: RegEx Help - generating ULs from text
>>>>
>>>> There was a set of tags written by Fletcher for encoding and
>>>> decoding "LassoWiki" text which included bullets. I have the code.
>>>> I was trying to find it on LassoSoft as it was once part of the tip
>>>> of the week series.
>>>> If I can't find it, I can post it on tag swap, though I take no
>>>> credit for it myself.
>>>>
>>>>
>>>>
>>>> Shelane French
>>>> Workforce Enablement
>>>> Livermore Information Technology
>>>>
>>>>
>>>>
>>>>
>>>> On 6/8/16, 6:06 AM, "[hidden email] on behalf of
>>>> Jon Harris" <[hidden email] on behalf of
>>>> [hidden email]> wrote:
>>>>
>>>> Actually, that didn't work. It creates separate ULs for each line.
>>>>>
>>>>> ... back to the drawing board.
>>>>>
>>>>>
>>>>> -----Original Message-----
>>>>> From: [hidden email]
>>>>> [mailto:[hidden email]] On Behalf Of Jon Harris
>>>>> Sent: 08 June 2016 14:02
>>>>> To: [hidden email]
>>>>> Subject: RE: RegEx Help - generating ULs from text
>>>>>
>>>>> I think I might have got it working:
>>>>>
>>>>> var('newString') =
>>>>> String_ReplaceRegExp(var('theString'),-find="\n\s?\\+\s?(.*)",-rep
>>>>> lace=
>>>>> "<u
>>>>> l><li>\\1</li></ul>");
>>>>>
>>>>>
>>>>>
>>>>> -----Original Message-----
>>>>> From: [hidden email]
>>>>> [mailto:[hidden email]] On Behalf Of Jon Harris
>>>>> Sent: 08 June 2016 13:45
>>>>> To: [hidden email]
>>>>> Subject: RE: RegEx Help - generating ULs from text
>>>>>
>>>>> Sorry. I meant to add [LP8.6] in my subject.
>>>>>
>>>>>
>>>>> -----Original Message-----
>>>>> From: [hidden email]
>>>>> [mailto:[hidden email]] On Behalf Of Jolle
>>>>> Carlestam
>>>>> Sent: 08 June 2016 13:36
>>>>> To: [hidden email]
>>>>> Subject: Re: RegEx Help - generating ULs from text
>>>>>
>>>>> 8 juni 2016 kl. 14:33 skrev Jon Harris <[hidden email]>:
>>>>>
>>>>>>
>>>>>> I am a looking for a quick way of converting blocks of text to
>>>>>> <ul>, using regex.
>>>>>>
>>>>>
>>>>> Lasso 8 or 9?
>>>>>
>>>>> HDB
>>>>> Jolle
>>>>>
>>>>> #############################################################
>>>>>
>>>>> This message is sent to you because you are subscribed to  the
>>>>> mailing list Lasso [hidden email] Official list
>>>>> archives available at http://www.lassotalk.com To unsubscribe,
>>>>> E-mail
>>>>>
>>>> to:
>>>
>>>> <[hidden email]>
>>>>> Send administrative queries to  
>>>>> <[hidden email]>
>>>>>
>>>>> #############################################################
>>>>>
>>>>> This message is sent to you because you are subscribed to  the
>>>>> mailing list Lasso [hidden email] Official list
>>>>> archives available at http://www.lassotalk.com To unsubscribe,
>>>>> E-mail
>>>>>
>>>> to:
>>>
>>>> <[hidden email]>
>>>>> Send administrative queries to  
>>>>> <[hidden email]>
>>>>>
>>>>> #############################################################
>>>>>
>>>>> This message is sent to you because you are subscribed to  the
>>>>> mailing list Lasso [hidden email] Official list
>>>>> archives available at http://www.lassotalk.com To unsubscribe,
>>>>> E-mail
>>>>>
>>>> to:
>>>
>>>> <[hidden email]>
>>>>> Send administrative queries to  
>>>>> <[hidden email]>
>>>>>
>>>>> #############################################################
>>>>>
>>>>> This message is sent to you because you are subscribed to  the
>>>>> mailing list Lasso [hidden email] Official list
>>>>> archives available at http://www.lassotalk.com To unsubscribe,
>>>>> E-mail
>>>>> to: <[hidden email]>
>>>>> Send administrative queries to  
>>>>> <[hidden email]>
>>>>>
>>>>
>>>>
>>>> #############################################################
>>>>
>>>> This message is sent to you because you are subscribed to the
>>>> mailing list Lasso [hidden email] Official list archives
>>>> available at http://www.lassotalk.com To unsubscribe, E-mail to:
>>>> <[hidden email]>
>>>> Send administrative queries to  <[hidden email]>
>>>>
>>>> #############################################################
>>>>
>>>> This message is sent to you because you are subscribed to the
>>>> mailing list Lasso [hidden email] Official list archives
>>>> available at http://www.lassotalk.com To unsubscribe, E-mail to:
>>>> <[hidden email]>
>>>> Send administrative queries to  <[hidden email]>
>>>>
>>>
>>>
>>> #############################################################
>>>
>>> This message is sent to you because you are subscribed to the
>>> mailing list Lasso [hidden email] Official list archives
>>> available at http://www.lassotalk.com To unsubscribe, E-mail to:
>>> <[hidden email]>
>>> Send administrative queries to  <[hidden email]>
>>>
>>>
>> #############################################################
>>
>> This message is sent to you because you are subscribed to the mailing
>> list Lasso [hidden email] Official list archives available
>> at http://www.lassotalk.com To unsubscribe, E-mail to:
>> <[hidden email]>
>> Send administrative queries to  <[hidden email]>
>>
>
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> Steve Piercy              Website Builder              Soquel, CA
> <[hidden email]>               <http://www.stevepiercy.com/>
>
>
>
> #############################################################
>
> This message is sent to you because you are subscribed to  the mailing
> list Lasso [hidden email] Official list archives available
> at http://www.lassotalk.com To unsubscribe, E-mail to:
> <[hidden email]>
> Send administrative queries to  <[hidden email]>
>

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email] Official list archives available at http://www.lassotalk.com To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

RE: RegEx Help - generating ULs from text

stevepiercy
There's no such tutorial.  There is the Language Guide, and a
nice little Lasso tool that you might have installed at:
http://localhost/Reference.LassoApp?utility/regexp

That tool helps convert a true PCRE into an escaped version that
Lasso 8 can use.

I also have BBEdit's grep reference bookmarked in my browser,
because I loathe Apple's Help interface.
file:///Applications/BBEdit.app/Contents/Resources/BBEdit%20Help/index_grep.htm

This is another good resource.  There are flavors of regex, but
PCRE is what you want.
https://regex101.com/

--steve


On 6/9/16 at 9:04 AM, [hidden email] (Jon Harris) pronounced:

>Hi Bill
>
>Many thanks to you, Steve, Jason and Shelane.
>
>I have munged some of Fletcher's "lassowiki" tags into a
>"listfinder" tag, so I have got a solution. However, your code
>is much more compact, so I have made it into a tag, and added
>it to our tag library.
>
>This has exposed my limit knowledge and understanding of regex.
>I have now looking at getting the boldly named:
>"Teach Yourself Regular Expressions in 10 Minutes" book. So by
>tomorrow I should be an expert :-)
>
>- Unless anyone has any alternative suggestions. I would love
>to find a Lasso specific tutorial, which includes things like
>"matchstring", and the "regexp" command itself.
>
>Regards
>Jon
>
>
>-----Original Message-----
>From: [hidden email]
>[mailto:[hidden email]] On Behalf Of Bil Corry
>Sent: 08 June 2016 20:21
>To: [hidden email]
>Subject: Re: RegEx Help - generating ULs from text
>
>Here's one way to do it, if you're going to roll your own...
>
>- Bil
>
>[
>
>var('mytext') = "
>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
>eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
>enim ad minim veniam, quis nostrud exercitation ullamco laboris
>nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
>in reprehenderit in voluptate velit esse cillum dolore eu
>fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
>proident, sunt in culpa qui officia deserunt mollit anim id est laborum
>
>+ item one
>+ item two
>+ item three
>
>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
>eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
>enim ad minim veniam, quis nostrud exercitation ullamco laboris
>nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
>in reprehenderit in voluptate velit esse cillum dolore eu
>fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
>proident, sunt in culpa qui officia deserunt mollit anim id est laborum
>
>+ another item
>+ yet another
>+ good times
>+ test 123
>
>Wheeeee!
>
>";
>
>var('out') =
>string_replaceregexp($mytext,-find="(\\s*\\+\\s*)([^\r\n]+)",-replace="<li>\\2</li>");
>$out =
>string_replaceregexp($out,-find="</li>(?!(<li>))",-replace="</li></ul>");
>$out =
>string_replaceregexp($out,-find="(?<!</li>)<li>",-replace="<ul><li>");
>
>$out;
>
>]
>
>
>
>On Wed, Jun 8, 2016 at 8:09 PM, Steve Piercy - Website Builder
>< [hidden email]> wrote:
>
>>Aw, c'mon, it's more fun to reinvent the wheel.  :P
>>
>>Seriously, docutils and Python FTW!
>>
>>IMO reStructuredText is the best markup language for writing
>>documentation and content.  It's better than markdown and
>>others because it automatically generates links between pages,
>>modules, indices, and libraries.
>>
>>Add Sphinx to theme or skin your docs into multi-page
>>feature-rich websites, PDFs, epubs, or just text.
>>http://www.sphinx-doc.org/en/stable/
>>
>>It was at my incessant urging that LassoSoft used .rst for:
>>http://lassoguide.com/
>>
>>I use it almost daily for my open source contributions to
>>Pyramid documentation.
>>http://docs.pylonsproject.org/projects/pyramid/en/latest/
>>
>>And I use .rst through Pelican to generate my own static
>>website with live Lasso demos.
>>
>>http://www.stevepiercy.com/articles/refreshing-responsive-redesign-wit
>>h-pelican-and-zurb-foundation/
>>
>>--steve
>>
>>
>>On 6/8/16 at 11:39 AM, [hidden email] (Jason Huck) pronounced:
>>
>>
>>I would recommend using an existing, documented, and
>>maintained tool that
>>> converts plain text markup into HTML. Have a look at reStructuredText:
>>>
>>> http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html
>>>
>>>  If you install the docutils package you can probably call
>>>rst2html  via os_process.
>>>
>>> - jason
>>>
>>>
>>>
>>> On Wed, Jun 8, 2016 at 11:29 AM, French, Shelane <[hidden email]>
>>> wrote:
>>>
>>> Found something that describes it:
>>>>
>>>>
>>>> http://www.lassosoft.com/Regular-Expression-Challenge-Wiki-Style-For
>>>> matting
>>>>
>>>> It uses old colon syntax, but that still works in 8.6, though not ideal.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Shelane French
>>>> Workforce Enablement
>>>> Livermore Information Technology
>>>>
>>>>
>>>>
>>>>
>>>>  On 6/8/16, 8:28 AM, "[hidden email] on
>>>>behalf of  Jon Harris" <[hidden email] on
>>>>behalf of  [hidden email]> wrote:
>>>>
>>>> Hi Shelane
>>>>>
>>>>> Yes please.  I'm still stuck on this.
>>>>>
>>>>> Regards
>>>>> Jon
>>>>>
>>>>> -----Original Message-----
>>>>>  From: [hidden email]  
>>>>>[mailto:[hidden email]] On Behalf Of
>>>>>French,  Shelane
>>>>> Sent: 08 June 2016 16:25
>>>>> To: [hidden email]
>>>>> Subject: Re: RegEx Help - generating ULs from text
>>>>>
>>>>>  There was a set of tags written by Fletcher for encoding
>>>>>and  decoding "LassoWiki" text which included bullets. I
>>>>>have the code.  I was trying to find it on LassoSoft as it
>>>>>was once part of the tip  of the week series.
>>>>>  If I can't find it, I can post it on tag swap, though I
>>>>>take no  credit for it myself.
>>>>>
>>>>>
>>>>>
>>>>> Shelane French
>>>>> Workforce Enablement
>>>>> Livermore Information Technology
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>  On 6/8/16, 6:06 AM, "[hidden email] on
>>>>>behalf of  Jon Harris" <[hidden email]
>>>>>on behalf of  [hidden email]> wrote:
>>>>>
>>>>> Actually, that didn't work. It creates separate ULs for each line.
>>>>>>
>>>>>> ... back to the drawing board.
>>>>>>
>>>>>>
>>>>>> -----Original Message-----
>>>>>>  From: [hidden email]  
>>>>>>[mailto:[hidden email]] On Behalf Of
>>>>>>Jon Harris
>>>>>> Sent: 08 June 2016 14:02
>>>>>> To: [hidden email]
>>>>>> Subject: RE: RegEx Help - generating ULs from text
>>>>>>
>>>>>> I think I might have got it working:
>>>>>>
>>>>>> var('newString') =
>>>>>> String_ReplaceRegExp(var('theString'),-find="\n\s?\\+\s?(.*)",-rep
>>>>>> lace=
>>>>>> "<u
>>>>>> l><li>\\1</li></ul>");
>>>>>>
>>>>>>
>>>>>>
>>>>>> -----Original Message-----
>>>>>>  From: [hidden email]  
>>>>>>[mailto:[hidden email]] On Behalf Of
>>>>>>Jon Harris
>>>>>> Sent: 08 June 2016 13:45
>>>>>> To: [hidden email]
>>>>>> Subject: RE: RegEx Help - generating ULs from text
>>>>>>
>>>>>> Sorry. I meant to add [LP8.6] in my subject.
>>>>>>
>>>>>>
>>>>>> -----Original Message-----
>>>>>>  From: [hidden email]  
>>>>>>[mailto:[hidden email]] On Behalf Of
>>>>>>Jolle  Carlestam
>>>>>> Sent: 08 June 2016 13:36
>>>>>> To: [hidden email]
>>>>>> Subject: Re: RegEx Help - generating ULs from text
>>>>>>
>>>>>> 8 juni 2016 kl. 14:33 skrev Jon Harris <[hidden email]>:
>>>>>>
>>>>>>>
>>>>>>>  I am a looking for a quick way of converting blocks of
>>>>>>>text to  <ul>, using regex.
>>>>>>>
>>>>>>
>>>>>> Lasso 8 or 9?
>>>>>>
>>>>>> HDB
>>>>>> Jolle
>>>>>>
>>>>>> #############################################################
>>>>>>
>>>>>>  This message is sent to you because you are subscribed
>>>>>>to  the  mailing list Lasso [hidden email]
>>>>>>Official list  archives available at
>>>>>>http://www.lassotalk.com To unsubscribe,  E-mail
>>>>>>
>>>>> to:
>>>>
>>>>> <[hidden email]>
>>>>>>  Send administrative queries to   <[hidden email]>
>>>>>>
>>>>>> #############################################################
>>>>>>
>>>>>>  This message is sent to you because you are subscribed
>>>>>>to  the  mailing list Lasso [hidden email]
>>>>>>Official list  archives available at
>>>>>>http://www.lassotalk.com To unsubscribe,  E-mail
>>>>>>
>>>>> to:
>>>>
>>>>> <[hidden email]>
>>>>>>  Send administrative queries to   <[hidden email]>
>>>>>>
>>>>>> #############################################################
>>>>>>
>>>>>>  This message is sent to you because you are subscribed
>>>>>>to  the  mailing list Lasso [hidden email]
>>>>>>Official list  archives available at
>>>>>>http://www.lassotalk.com To unsubscribe,  E-mail
>>>>>>
>>>>> to:
>>>>
>>>>> <[hidden email]>
>>>>>>  Send administrative queries to   <[hidden email]>
>>>>>>
>>>>>> #############################################################
>>>>>>
>>>>>>  This message is sent to you because you are subscribed
>>>>>>to  the  mailing list Lasso [hidden email]
>>>>>>Official list  archives available at
>>>>>>http://www.lassotalk.com To unsubscribe,  E-mail
>>>>>> to: <[hidden email]>
>>>>>>  Send administrative queries to   <[hidden email]>
>>>>>>
>>>>>
>>>>>
>>>>> #############################################################
>>>>>
>>>>>  This message is sent to you because you are subscribed to
>>>>>the  mailing list Lasso [hidden email] Official
>>>>>list archives  available at http://www.lassotalk.com To
>>>>>unsubscribe, E-mail to:
>>>>> <[hidden email]>
>>>>> Send administrative queries to  <[hidden email]>
>>>>>
>>>>> #############################################################
>>>>>
>>>>>  This message is sent to you because you are subscribed to
>>>>>the  mailing list Lasso [hidden email] Official
>>>>>list archives  available at http://www.lassotalk.com To
>>>>>unsubscribe, E-mail to:  <[hidden email]>
>>>>> Send administrative queries to  <[hidden email]>
>>>>>
>>>>
>>>>
>>>> #############################################################
>>>>
>>>>  This message is sent to you because you are subscribed to
>>>>the  mailing list Lasso [hidden email] Official
>>>>list archives  available at http://www.lassotalk.com To
>>>>unsubscribe, E-mail to:  <[hidden email]>
>>>> Send administrative queries to  <[hidden email]>
>>>>
>>>>
>>> #############################################################
>>>
>>>  This message is sent to you because you are subscribed to
>>>the mailing  list Lasso [hidden email] Official
>>>list archives available  at http://www.lassotalk.com To
>>>unsubscribe, E-mail to:  <[hidden email]>
>>> Send administrative queries to  <[hidden email]>
>>>
>>
>>-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
>>Steve Piercy              Website Builder              Soquel, CA
>><[hidden email]>               <http://www.stevepiercy.com/>
>>
>>
>>
>>#############################################################
>>
>>This message is sent to you because you are subscribed to  the
>>mailing list Lasso [hidden email] Official list
>>archives available at http://www.lassotalk.com To unsubscribe,
>>E-mail to: <[hidden email]>
>>Send administrative queries to  <[hidden email]>
>>
>
>#############################################################
>
>This message is sent to you because you are subscribed to
>the mailing list Lasso [hidden email] Official list
>archives available at http://www.lassotalk.com To unsubscribe,
>E-mail to: <[hidden email]>
>Send administrative queries to  <[hidden email]>
>
>#############################################################
>
>This message is sent to you because you are subscribed to
>the mailing list Lasso [hidden email]
>Official list archives available at http://www.lassotalk.com
>To unsubscribe, E-mail to: <[hidden email]>
>Send administrative queries to  <[hidden email]>

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Steve Piercy              Website Builder              Soquel, CA
<[hidden email]>               <http://www.stevepiercy.com/>


#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>