You'll have to do the regex replace on the server side (or in the SQL
query), as the errant quotes will likely cause a syntax error in js and
stop execution. I don't use ASP, so I can't help you with the code to make
the regex happen, but the match string you want to use is probably:
(['"])
which will capture both single and double quotes. I would assume that
ASP's regex engine can handle using the captured string in the replacement.
On Wednesday, May 30, 2012 2:07:24 PM UTC-4, tobe wrote:
>
> Hi everyone!
>
> I am using ASP NET with google chart API.
> I am filling a table like this:
>
> var data = google.visualization.arrayToDataTable([ ['Movie', 'Status'],
> ["Movie
> 1", "On Sale"] ,
> ["Movie 2", "Sold out"] ,
> ["Movie 3", "Coming goon"]
> ]);
> Data is coming from a SQL Server Database.
>
> The problem is if I have for example a movie which name has single quote
> (') or double quote (").
> When I try to parse that, an error ocurred.
>
> I think I can use regular expressions to parse data without those
> characters.
>
> Do anyone know which regular expression should I use?
> I am not sure if I know all the characters / scenarios that can "break" my
> code.
>
> Thanks
>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-visualization-api/-/OeSEpNuVDxwJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-visualization-api?hl=en.