Search
-
Re: Parsing keywords. This piece of code may come in handy
Hey flyingdutchie... funny, I wrote a parser too. Gotta watch out for semi-colons too: sub parsekeys { my $oldkeywords = '' ; my @allkeywords = @quotedkeywords = @splitkeywords = () ; $oldkeywords = shift ;# Decode the HTML entities $oldkeywords =~ s|\\"|"|g ; $oldkeywords = decode_entities($oldkeywords) ;# Let's pluck out… -
Re: Parsing keywords. This piece of code may come in handy
Hi, I thought I wrote back on this. I discovered that for some reason, SmugMug converts " marks into \" Additionally, it converts things like & into &, etc. I didn't want to deal with entities at all, and it turns out that if you submit them back through the API, SmugMug converts them for you. So I end up using the Perl… -
Re: Parsing keywords. This piece of code may come in handy
Here is my code for fixing keywords in Rubydef self.fixKeywords(keywords) if keywords.nil? return "" end newKeywords = keywords.collect do |key| # remove any quotes or punctuation newkey = key.gsub(/["'.:?~`!\@#\$%\^&\*\(\)<>\?,\/\-\+\=]/, '') # we need to make sure that keywords are restricted to 40 characters. if… -
Re: Parsing keywords. This piece of code may come in handy
-
Parsing keywords. This piece of code may come in handy
Hi everyone, I wrote, for my SmugFig API, this piece of code that transforms a string of keywords into an ArrayList of these keywords. It is a snippet of Java code.public SomeClass {...... private static final String quotePattern = "(\"([^\"]+)\"[\\s,;]*)"; private static final String commaPattern = "(([^,;]+)\\s*[,;]?)";…
5 results