* error when using split-regex
@ 2017-03-09 10:31 Damien MATTEI
2017-03-09 17:57 ` Per Bothner
2017-03-09 19:43 ` Per Bothner
0 siblings, 2 replies; 5+ messages in thread
From: Damien MATTEI @ 2017-03-09 10:31 UTC (permalink / raw)
To: kawa
Hi,
i have got an error in code when using regex-split,
here is the code tested here at REPL in kawa 2.1:
(require 'regex)
(define wds-url "http://ad.usno.navy.mil/wds/Webtextfiles/wdsnewref.txt")
(define wds-data-str &<{&[wds-url]}) ;; could take a few seconds to GET file
(define wds-data-str-split (regex-split wds-data-str (string #\return)))
result in this error at some point of splitting:
^
at java.util.regex.Pattern.error(Pattern.java:1955)
at java.util.regex.Pattern.sequence(Pattern.java:2123)
at java.util.regex.Pattern.expr(Pattern.java:1996)
at java.util.regex.Pattern.group0(Pattern.java:2905)
at java.util.regex.Pattern.sequence(Pattern.java:2051)
at java.util.regex.Pattern.expr(Pattern.java:1996)
at java.util.regex.Pattern.compile(Pattern.java:1696)
at java.util.regex.Pattern.<init>(Pattern.java:1351)
at java.util.regex.Pattern.compile(Pattern.java:1028)
at kawa.lib.kawa.regex.regexSplit(regex.scm:51)
at atInteractiveLevel-6.run(stdin:6)
at gnu.expr.ModuleExp.evalModule2(ModuleExp.java:293)
at gnu.expr.ModuleExp.evalModule(ModuleExp.java:212)
at kawa.Shell.run(Shell.java:291)
at kawa.Shell.run(Shell.java:203)
at kawa.Shell.run(Shell.java:184)
at kawa.repl.processArgs(repl.java:687)
at kawa.repl.main(repl.java:793)
also tested it with #\linefeed and same error, also tested with " " and "A" : error
i did not look in the contain of the file and i will do it,but anyway the result should not be an error?
does the newest version of kawa give a different result?
Regards,
Damien
--
Damien.Mattei@unice.fr, Damien.Mattei@oca.eu, UNS / OCA / CNRS
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: error when using split-regex
2017-03-09 10:31 error when using split-regex Damien MATTEI
@ 2017-03-09 17:57 ` Per Bothner
2017-03-09 19:43 ` Per Bothner
1 sibling, 0 replies; 5+ messages in thread
From: Per Bothner @ 2017-03-09 17:57 UTC (permalink / raw)
To: Damien MATTEI, kawa
On 03/09/2017 02:31 AM, Damien MATTEI wrote:
> Hi,
>
> i have got an error in code when using regex-split,
> here is the code tested here at REPL in kawa 2.1:
>
> (require 'regex)
>
> (define wds-url "http://ad.usno.navy.mil/wds/Webtextfiles/wdsnewref.txt")
That web-site is currently not available.
> (define wds-data-str &<{&[wds-url]}) ;; could take a few seconds to GET file
> (define wds-data-str-split (regex-split wds-data-str (string #\return)))
>
> result in this error at some point of splitting:
>
> ^
> at java.util.regex.Pattern.error(Pattern.java:1955)
What is the exception thrown?
--
--Per Bothner
per@bothner.com http://per.bothner.com/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: error when using split-regex
2017-03-09 10:31 error when using split-regex Damien MATTEI
2017-03-09 17:57 ` Per Bothner
@ 2017-03-09 19:43 ` Per Bothner
2017-03-09 19:46 ` Per Bothner
1 sibling, 1 reply; 5+ messages in thread
From: Per Bothner @ 2017-03-09 19:43 UTC (permalink / raw)
To: Damien MATTEI, kawa
On 03/09/2017 02:31 AM, Damien MATTEI wrote:
> Hi,
>
> i have got an error in code when using regex-split,
> here is the code tested here at REPL in kawa 2.1:
>
> (require 'regex)
>
> (define wds-url "http://ad.usno.navy.mil/wds/Webtextfiles/wdsnewref.txt")
> (define wds-data-str &<{&[wds-url]}) ;; could take a few seconds to GET file
> (define wds-data-str-split (regex-split wds-data-str (string #\return)))
Try switching the order of the arguments to regex-split.
--
--Per Bothner
per@bothner.com http://per.bothner.com/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: error when using split-regex
2017-03-09 19:43 ` Per Bothner
@ 2017-03-09 19:46 ` Per Bothner
2017-03-10 9:44 ` Damien MATTEI
0 siblings, 1 reply; 5+ messages in thread
From: Per Bothner @ 2017-03-09 19:46 UTC (permalink / raw)
To: Damien MATTEI, kawa
On 03/09/2017 11:42 AM, Per Bothner wrote:
> On 03/09/2017 02:31 AM, Damien MATTEI wrote:
>> Hi,
>>
>> i have got an error in code when using regex-split,
>> here is the code tested here at REPL in kawa 2.1:
>>
>> (require 'regex)
>>
>> (define wds-url "http://ad.usno.navy.mil/wds/Webtextfiles/wdsnewref.txt")
>> (define wds-data-str &<{&[wds-url]}) ;; could take a few seconds to GET file
>> (define wds-data-str-split (regex-split wds-data-str (string #\return)))
>
> Try switching the order of the arguments to regex-split.
What I did is I saved the file, and then trimmed it down until the output
would fit in the scroll-back buffer. Then I saw:
java.util.regex.PatternSyntaxException: Dangling meta character '+' near index 4730
That was the clue that the arguments were switched. Confirmed by checking the manual.
--
--Per Bothner
per@bothner.com http://per.bothner.com/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: error when using split-regex
2017-03-09 19:46 ` Per Bothner
@ 2017-03-10 9:44 ` Damien MATTEI
0 siblings, 0 replies; 5+ messages in thread
From: Damien MATTEI @ 2017-03-10 9:44 UTC (permalink / raw)
To: Per Bothner; +Cc: kawa
Le Thursday 09 March 2017 20:46:11 Per Bothner, vous avez écrit :
> On 03/09/2017 11:42 AM, Per Bothner wrote:
> > On 03/09/2017 02:31 AM, Damien MATTEI wrote:
> >> Hi,
> >>
> >> i have got an error in code when using regex-split,
> >> here is the code tested here at REPL in kawa 2.1:
> >>
> >> (require 'regex)
> >>
> >> (define wds-url "http://ad.usno.navy.mil/wds/Webtextfiles/wdsnewref.txt")
> >> (define wds-data-str &<{&[wds-url]}) ;; could take a few seconds to GET file
> >> (define wds-data-str-split (regex-split wds-data-str (string #\return)))
> >
> > Try switching the order of the arguments to regex-split.
>
> What I did is I saved the file, and then trimmed it down until the output
> would fit in the scroll-back buffer. Then I saw:
>
> java.util.regex.PatternSyntaxException: Dangling meta character '+' near index 4730
>
> That was the clue that the arguments were switched. Confirmed by checking the manual.
thank you Per ,
it works now, i had swapped the args and the line separator was LF and not CR:
(let* ((marequete "SELECT * FROM Obs ORDER BY Auteur")
(rs ::java.sql.ResultSet #!null)
(total '())
(result '())
(wds-url "http://ad.usno.navy.mil/wds/Webtextfiles/wdsnewref.txt")
(wds-data-str &<{&[wds-url]})
(str1 (substring wds-data-str 0 30))
(len-wds-data-str (string-length wds-data-str))
;;(wds-data-str-split (regex-split (string #\return) wds-data-str))
(wds-data-str-split (regex-split (string #\linefeed) wds-data-str))
)
(display-msg-var-nl "DBtoWebObserversKawa : work : str1 = " str1)
(display-msg-var-nl "DBtoWebObserversKawa : work : length wds-data-str = " len-wds-data-str)
(display-msg-var-nl "DBtoWebObserversKawa : work : (car wds-data-str-split) = " (car wds-data-str-split))
output in Tomcat log:
Aujourd'hui 10:37:21
DBtoWebObserversKawa : work : str1 = WDS Astrometry, Interferometri
DBtoWebObserversKawa : work : length wds-data-str = 2723073
DBtoWebObserversKawa : work : (car wds-data-str-split) = WDS Astrometry, Interferometric, Linear, Orbit, and DM Catalogs: References
Regards,
Damien
--
Damien.Mattei@unice.fr, Damien.Mattei@oca.eu, UNS / OCA / CNRS
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-03-10 9:44 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-09 10:31 error when using split-regex Damien MATTEI
2017-03-09 17:57 ` Per Bothner
2017-03-09 19:43 ` Per Bothner
2017-03-09 19:46 ` Per Bothner
2017-03-10 9:44 ` Damien MATTEI
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).