public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
From: Damien MATTEI <Damien.Mattei@unice.fr>
To: Per Bothner <per@bothner.com>
Cc: kawa <kawa@sourceware.org>
Subject: Re: error when using split-regex
Date: Fri, 10 Mar 2017 09:44:00 -0000	[thread overview]
Message-ID: <201703101044.45857.Damien.Mattei@unice.fr> (raw)
In-Reply-To: <ad3562cb-d5d3-d8bd-e9d8-3a21eb8b27ba@bothner.com>

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

      reply	other threads:[~2017-03-10  9:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-09 10:31 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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201703101044.45857.Damien.Mattei@unice.fr \
    --to=damien.mattei@unice.fr \
    --cc=kawa@sourceware.org \
    --cc=per@bothner.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).