Re: Regex help...

2017-06-07 Thread Dr. Hawkins via use-livecode
On Sun, Jun 4, 2017 at 1:45 PM, hh via use-livecode < use-livecode@lists.runrev.com> wrote: > Your "ie" is not true. So what do you want? Regexp is red, my face turneth blue. My heart is now shattered, For my "ie" ie is untrue. :) -- Dr. Richard E. Hawkins, Esq. (702) 508-8462

Re: Regex help...

2017-06-07 Thread Robert Brenstein via use-livecode
If the number of comma-delimited and tab-delimited elements is always the same, I would replace all commas with tabs and then filter to have item x having value of y. Robert On 5 Jun 2017, at 15:23, Paul Dupuis via use-livecode wrote: Thank you Thierry and everyone else. I should have

Re: Regex help...

2017-06-05 Thread Thierry Douez via use-livecode
@Paul, to defend you, it's not always so obvious to know what we can or cannot do with regex. @Mike yes, Perl is great and that's certainly why I have embeded Perl in LiveCode, Mmm, more than 10 years ago. I've also helped some well known LiveCoders to do some complex transformation with Perl

AW: Regex help...

2017-06-05 Thread Paul Dupuis via use-livecode
Thank you Thierry and everyone else. I should have realized that I couldn't do this entirely with regex due to the need to compare the number values. It was a long day yesterday and my brain just wasn't in full gear. -- Paul On 6/5/2017 4:06 AM, Thierry Douez via use-livecode wrote: > Hi Paul,

Re: Regex help...

2017-06-05 Thread Mike Bonner via use-livecode
Wow, the perl way is pretty darn cool. On Mon, Jun 5, 2017 at 2:06 AM, Thierry Douez via use-livecode < use-livecode@lists.runrev.com> wrote: > Hi Paul, > > > AFAIK you need to deal with an hybrid approach (regex + livecode) > > So, here is one way to do it: > > >put 3 into pPage > >

Re: Regex help...

2017-06-05 Thread Thierry Douez via use-livecode
Hi Paul, AFAIK you need to deal with an hybrid approach (regex + livecode) So, here is one way to do it: put 3 into pPage repeat for each line T in tCiCData if matchText( T, "(?x) \t (\d+) , \d+ , (\d+) , \d+ \z", n1, n2) then if (n1 <= pPage) and (n2 >= pPage) then

Re: Regex help...

2017-06-04 Thread Mike Kerner via use-livecode
When I'm fighting a regex, I go to http://pythex.org/ On Sun, Jun 4, 2017 at 2:11 PM, Mike Bonner via use-livecode < use-livecode@lists.runrev.com> wrote: > Not sure regex can do what you want, or if it can its far far over my > head. Would it work instead to use lc script to parse? > If you

Re: Regex help...

2017-06-04 Thread hh via use-livecode
Forget it. I'm wrong, it's too late. Sorry. > hh wrote: > [a] all lines starting on page 2 OR ending on page 2 OR containing page 2 > ie > (pPage >= starting page) OR (pPage <= ending page) > > [b] all lines starting on page 2 AND ending on page 2 > ie > (pPage >= starting page) AND (pPage <=

Re: Regex help...

2017-06-04 Thread hh via use-livecode
Your "ie" is not true. So what do you want? [a] all lines starting on page 2 OR ending on page 2 OR containing page 2 ie (pPage >= starting page) OR (pPage <= ending page) [b] all lines starting on page 2 AND ending on page 2 ie (pPage >= starting page) AND (pPage <= ending page) > Paul D.

Re: Regex help...

2017-06-04 Thread Mike Bonner via use-livecode
Not sure regex can do what you want, or if it can its far far over my head. Would it work instead to use lc script to parse? If you repeat through your data (each line form, with tLine as the current line and pPage as the page to be looked for...) you can use a one liner like this to build a list

Regex help...

2017-06-04 Thread Paul Dupuis via use-livecode
I have a tab and cr delimited table of data, a sample line of which is below: 1Test4052,125941,4052,3,2388 The last tab delimited item "1,4052,3,2388" is actually ,,, So the starting page number is 1 and ending page is 3 I have a variable pPage which contain a page number, say "2" My regex

Re: AW: Re: Regex help needed...

2016-02-03 Thread Thierry Douez
​​ > Regex has been around a long time > and lots of smart computer science types has > spent time coming up with ways to optimize its performance for pattern > matching. That's was true, it's still true and will always be true! and here are some benchmarks done in a late rainy sunday

Re: AW: Re: Regex help needed...

2016-02-03 Thread Bernard Devlin
Hi Mark, There's huge differences in how regex implementations perform in different languages. For example: http://raid6.com.au/~onlyjob/posts/arena/ Perl outperforms everything in that test. I've never assumed that LC's "perl compatiable regex library" is going to perform at the speed which

Re: AW: Re: Regex help needed...

2016-02-03 Thread Ali Lloyd
On Wed, Feb 3, 2016 at 11:53 AM Bernard Devlin wrote: > One of the things we had in LC5 which was phenomenally fast, was searching > through the styledText of a field. That fast way of searching particular > text structures got lost in the migration to LC8. Could you expand

Re: AW: Re: Regex help needed...

2016-02-03 Thread Peter TB Brett
On 03/02/2016 11:53, Bernard Devlin wrote: Perl outperforms everything in that test. I've never assumed that LC's "perl compatiable regex library" is going to perform at the speed which actual Perl performs. I've always assumed that being "perl compatible" just meant that all

Re: AW: Re: Regex help needed...

2016-02-03 Thread Peter Haworth
Hi Thierry, I might have missed it but did you publish your Regex2 to the list? Pete On Wed, Feb 3, 2016 at 12:07 PM Richard Gaskin wrote: > Thierry Douez write: > > >> Regex has been around a long time > >> and lots of smart computer science types has > >> spent

Re: AW: Re: Regex help needed...

2016-02-03 Thread Thierry Douez
There's huge differences in how regex implementations perform in different > languages. For example: http://raid6.com.au/~onlyjob/posts/arena/ > ​Last year, I did some experiments: I had a 100 lines of LiveCode with a bunch of really big Regex. It took 120 seconds on my Macbook to run. I tried

Re: AW: Re: Regex help needed...

2016-02-03 Thread Richard Gaskin
Thierry Douez write: Regex has been around a long time and lots of smart computer science types has spent time coming up with ways to optimize its performance for pattern matching. That's was true, it's still true and will always be true! It's true that there are almost always ways to

Regex help needed...

2016-01-30 Thread Paul Dupuis
I need some regex help. I have a list that is of the form: i.e. 1Testing1,7471,1,1,747 2Testing752,18001,752,1,1800 3Testing5398,58462,320,2,768 4Testing3,111.951,683.915,302.268,385.751 3,111.951,683.915,302.268,385.751 can have a list of number

AW: Re: Regex help needed...

2016-01-30 Thread Paul Dupuis
Never mind. Solved it. It was the pattern for the 2nd format. Fixed with "(.+\t"&",\d+,\d+,\d+)|(.+\t\d+,\d+,"&",\d+)|(.+\t"&",\d*\.?\d*,\d*\.?\d*,\d*\.?\d*,\d*\.?\d*)" On 1/30/2016 3:17 PM, Paul Dupuis wrote: > I need some regex hel

Re: AW: Re: Regex help needed...

2016-01-30 Thread Richard Gaskin
he Web ambassa...@fourthworld.comhttp://www.FourthWorld.com Paul Dupuis wrote: Never mind. Solved it. It was the pattern for the 2nd format. Fixed with "(.+\t"&",\d+,\d+,\d+)|(.+\t\d+,\d+,&

Re: AW: Re: Regex help needed...

2016-01-30 Thread Paul Dupuis
Wow. I would not have expected such a significant difference. Regex has been around a long time and lots of smart computer science types has spent time coming up with ways to optimize its performance for pattern matching. I assumed (falsely) that regex based filters in LC would be on par or even

Re: AW: Re: Regex help needed...

2016-01-30 Thread Mark Wieder
On 01/30/2016 04:28 PM, Paul Dupuis wrote: 1) wondering if LC's hooks to whatever regex tool they are using under the hood is a good as it should be LC's regex library is the same PCRE library everyone else uses. And it's the latest released version. Regex's power lies in its ability to

Re: AW: Re: Regex help needed...

2016-01-30 Thread Richard Gaskin
Paul Dupuis wrote: > Wow. I would not have expected such a significant difference. Regex > has been around a long time and lots of smart computer science types > has spent time coming up with ways to optimize its performance for > pattern matching. I assumed (falsely) that regex based filters in

Re: Regex Help

2014-09-27 Thread Magicgate Software - Skip Kimpel
Michael, those are two awesome resources! Thanks. SKIP On Fri, Sep 26, 2014 at 7:23 PM, Michael Doub miked...@gmail.com wrote: Guys, I have been using these 2 sites lately and they are really a huge help in understanding regex: http://regex101.com/#pcre http://www.regexr.com Give them a

Re: Regex Help

2014-09-27 Thread Peter Haworth
Hi Skip, Not sure what can come before /after the string but here's a start .*/point-.*-landed\.html.* That will find your string with any number of chars before or after it. If you need to check for it at the start of a line, replace .* with a ^ at the start of the regexp. Pete lcSQL Software

Regex Help

2014-09-26 Thread Magicgate Software - Skip Kimpel
Hey LC / Regex gurus, I need help creating a regular expression that will filter out all instances where the pattern looks like this: /point-XXX-landed.html Obviously the XX section varies from item to item and is also of different character lengths. Anybody willing to give this a

Re: Regex Help

2014-09-26 Thread Mark Schonewille
Hi, It could be something like this: on mouseUp put */point-*-landed.html into myFilter put fld 1 into myData filter myData without myFilter put myData end mouseUp but if this doesn't work, you'll have to post an actual sample of your data. -- Best regards, Mark

Re: Regex Help

2014-09-26 Thread Magicgate Software - Skip Kimpel
Thanks Mark, Actually look for the regex version as I will be applying that externally before feeding into LC. Here is a sample of the data: /point-item1-landed.html /point-about.html /point-test.html /point-item2-landed.html /point-item300-landed.html The results I want returned are:

Re: Regex Help

2014-09-26 Thread Mark Schonewille
Hi, Then you can try this: on mouseUp put /point-item[0-9]+-landed.html into myFilter put fld 1 into myData filter myData with regex pattern myFilter put myData end mouseUp This is a LiveCode example, but you can apply the regex /point-item[0-9]+-landed.html in PHP or

Re: Regex Help

2014-09-26 Thread Magicgate Software - Skip Kimpel
The middle item X does not always have a number in it. The common denominator between all the items I WANT to keep start with page- and end with -landed.html On Fri, Sep 26, 2014 at 4:37 PM, Mark Schonewille m.schonewi...@economy-x-talk.com wrote: Hi, Then you can try this: on mouseUp

Re: Regex Help

2014-09-26 Thread Mark Schonewille
Then what exactly does the middle item contain? Numbers and letters? Special symbols? Chinese? -- Best regards, Mark Schonewille Economy-x-Talk Consulting and Software Engineering Homepage: http://economy-x-talk.com Twitter: http://twitter.com/xtalkprogrammer KvK: 50277553 Installer Maker

Re: Regex Help

2014-09-26 Thread Magicgate Software - Skip Kimpel
Sorry... it contains letters. Sorry for the confusion. I should have been more complete with my explanation and sample data. SKIP On Fri, Sep 26, 2014 at 4:51 PM, Mark Schonewille m.schonewi...@economy-x-talk.com wrote: Then what exactly does the middle item contain? Numbers and letters?

Re: Regex Help

2014-09-26 Thread Mark Schonewille
Hi Skip, If it contains numbers and letters, it could be /point-item[0-9a-zA-Z]+-landed.html and if it contains anything except whitespace, it could be /point-item[\w]+-landed.html Both options work with the sample data you provided. -- Best regards, Mark Schonewille Economy-x-Talk

Re: Regex Help

2014-09-26 Thread Magicgate Software - Skip Kimpel
Thank you Mark! On Fri, Sep 26, 2014 at 4:58 PM, Mark Schonewille m.schonewi...@economy-x-talk.com wrote: Hi Skip, If it contains numbers and letters, it could be /point-item[0-9a-zA-Z]+-landed.html and if it contains anything except whitespace, it could be /point-item[\w]+-landed.html

Re: Regex Help

2014-09-26 Thread Michael Doub
Guys, I have been using these 2 sites lately and they are really a huge help in understanding regex: http://regex101.com/#pcre http://www.regexr.com Give them a try… Mike On Sep 26, 2014, at 5:34 PM, Magicgate Software - Skip Kimpel s...@magicgate.com wrote: Thank you Mark! On Fri,

regex help please

2012-02-09 Thread Klaus on-rev
Hi friends, in my current project I need to deal with VERY small XML files with maybe up to 20 entries. So using the XML external seems to be a bit overkill. Some time ago I found a little reg ex here on the list which I turned into a function and will return me everything inside of a given

Re: regex help please

2012-02-09 Thread Andre Garzia
Klaus, I used to work like that, doing little XML files with RegEx and matchText. After working like that for a long time, I came to realize that there was no advantage at all in my case. It was simpler to work with RevXML. The problem with RegEx is all the little cases where it fails. I think

Re: regex help please

2012-02-09 Thread Ken Corey
On 09/02/2012 20:24, Klaus on-rev wrote: in my current project I need to deal with VERY small XML files with maybe up to 20 entries. Wait, didn't we just hear that you can't parse html (or XML) with regexps? *grin* function mk_getXMLdata tText, tTag get matchText(tText,(?s) tTag

Re: regex help please

2012-02-09 Thread Mark Wieder
Klaus, What Andre said. Nonetheless, if you want to continue down the regex path, try something like get matchText(tText,(?s) tTag (.*?)/ tTag ,tValue) replace tTagtValue / tTag with tTagtNewValue / tTag in tText -- Mark Wieder

Re: regex help please

2012-02-09 Thread Klaus on-rev
Hi Andre, Am 09.02.2012 um 21:38 schrieb Andre Garzia: Klaus, I used to work like that, doing little XML files with RegEx and matchText. After working like that for a long time, I came to realize that there was no advantage at all in my case. It was simpler to work with RevXML. The

Re: regex help please

2012-02-09 Thread Klaus on-rev
Hi guys, Am 09.02.2012 um 21:52 schrieb Mark Wieder: Klaus, What Andre said. Sigh... :-) Nonetheless, if you want to continue down the regex path, try something like get matchText(tText,(?s) tTag (.*?)/ tTag ,tValue) replace tTagtValue / tTag with tTagtNewValue /

Re: regex help please

2012-02-09 Thread Andre Garzia
Klaus, Since you have control, then instead of RegEx, you can go like mynode nodecontent /mynode All in different lines, then, you can just use lineOffset to find the start node and the end node and copy or replace the data between those lines. It is easier than RegEx. On Thu, Feb 9, 2012 at

Re: regex help please

2012-02-09 Thread Klaus on-rev
Hi Andre, Am 09.02.2012 um 22:05 schrieb Andre Garzia: Klaus, Since you have control, then instead of RegEx, you can go like mynode nodecontent /mynode All in different lines, then, you can just use lineOffset to find the start node and the end node and copy or replace the data

Re: regex help please

2012-02-09 Thread Ken Corey
On 09/02/2012 21:00, Klaus on-rev wrote: get matchText(tText,(?s) tTag (.*?)/ tTag ,tValue) replace tTagtValue/ tTag with tTagtNewValue/ tTag in tText well, I did not want to pass the text that I want to overwrite in the XML, which I do not now in that moment! But

Re: regex help please

2012-02-09 Thread Ken Ray
Nonetheless, if you want to continue down the regex path, try something like get matchText(tText,(?s) tTag (.*?)/ tTag ,tValue) replace tTagtValue / tTag with tTagtNewValue / tTag in tText well, I did not want to pass the text that I want to overwrite in the XML,

Re: regex help please

2012-02-09 Thread Klaus on-rev
Hi friends, thank you all for your help, i got it to work now! Again thanks a lot! Best Klaus -- Klaus Major http://www.major-k.de kl...@major.on-rev.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to

Re: regex help please

2012-02-09 Thread Bob Sneidar
Your training is almost complete. Destroy Darth Vader and take his place at my side! Mooo haah haah haha hahah ahah! Bob On Feb 9, 2012, at 12:24 PM, Klaus on-rev wrote: So with this text above in tText and tag2 int tTag: function mk_getXMLdata tText, tTag get matchText(tText,(?s)