String/RegEx?

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

String/RegEx?

Lee Glickenhaus-2
Before I sink a ton of time into a potential rabbit hole, I’m hoping that someone can tell me if Lasso can do what I’m after….

I have a large text field in MySQL.  I want to be able to search for one or more strings (“the dog”) and display the results with X number of words/characters before and after so that people can see the hits in context and leave out the huge amounts of extraneous text.

I didn’t see an obvious way of doing this in the docs and List so, is this a fool’s errand or is it something that can be done?

thanks

lee


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

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: String/RegEx?

Mason Miller
I am sure you can do this in MySQL.

Mason

Sent from my iPhone

> On Apr 29, 2015, at 6:17 PM, Lee Glickenhaus (lists) <[hidden email]> wrote:
>
> Before I sink a ton of time into a potential rabbit hole, I’m hoping that someone can tell me if Lasso can do what I’m after….
>
> I have a large text field in MySQL.  I want to be able to search for one or more strings (“the dog”) and display the results with X number of words/characters before and after so that people can see the hits in context and leave out the huge amounts of extraneous text.
>
> I didn’t see an obvious way of doing this in the docs and List so, is this a fool’s errand or is it something that can be done?
>
> thanks
>
> lee
>
>
> #############################################################
>
> 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: String/RegEx?

Jolle Carlestam-2
In reply to this post by Lee Glickenhaus-2
30 apr 2015 kl. 00:17 skrev Lee Glickenhaus (lists) <[hidden email]>:

> Before I sink a ton of time into a potential rabbit hole, I’m hoping that someone can tell me if Lasso can do what I’m after….
>
> I have a large text field in MySQL.  I want to be able to search for one or more strings (“the dog”) and display the results with X number of words/characters before and after so that people can see the hits in context and leave out the huge amounts of extraneous text.
>
> I didn’t see an obvious way of doing this in the docs and List so, is this a fool’s errand or is it something that can be done?
>
> thanks
>
> lee


Do the search for the actual string in Mysql. Use this regexp on the result:
(.{1,10})sed(.{1,10})

With ”sed” being the dog you’re looking for


Example:
[

local(
        textresult = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris consequat ornare lectus, dignissim iaculis libero consequat sed. Proin quis magna in arcu sagittis consequat sed ac risus. Ut a pharetra dui. Phasellus molestie, mauris eget scelerisque laoreet, diam dolor vulputate nulla, in porta sem sem sit amet lacus. Aenean sed volutpat magna. Vestibulum lobortis mollis lectus, eu semper quam congue at. Donec ac ligula a neque tincidunt elementum. Nam urna felis, interdum non ullamcorper eget, commodo viverra ligula. Fusce cursus dolor in nisl tincidunt non sagittis libero elementum. Maecenas rhoncus ornare gravida. Nullam luctus pulvinar lorem, laoreet aliquet massa malesuada eget.',
        serchregexp = regexp(`(.{1,10})sed(.{1,10})`),
        foundsnippets = array
)

#serchregexp -> setinput(#textresult)


while(#serchregexp -> find) => {
        #foundsnippets -> insert(#serchregexp -> matchstring)
}


#foundsnippets -> join('<br />')
]

->
consequat sed. Proin qu
consequat sed ac risus.
s. Aenean sed volutpat


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: String/RegEx?

Ke Carlton-3
In reply to this post by Lee Glickenhaus-2
Sure:

string_findregexp('the quick brown fox jumped over the lazy dog that was
sleeping', -find ='(?:\\w+\\W+){0,3}lazy dog(?:\\W+\\w+){0,3}')


Returns:

jumped over the lazy dog that was sleeping


The {0,3} part tell regexp to return up to 3 matches of the preceding
group: (?:\\w+\\W+) and (?:\\W+\\w+)

Ke


On 30 April 2015 at 10:17, Lee Glickenhaus (lists) <[hidden email]> wrote:

> Before I sink a ton of time into a potential rabbit hole, I’m hoping that
> someone can tell me if Lasso can do what I’m after….
>
> I have a large text field in MySQL.  I want to be able to search for one
> or more strings (“the dog”) and display the results with X number of
> words/characters before and after so that people can see the hits in
> context and leave out the huge amounts of extraneous text.
>
> I didn’t see an obvious way of doing this in the docs and List so, is this
> a fool’s errand or is it something that can be done?
>
> thanks
>
> lee
>
>
> #############################################################
>
> 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]>