输入数据到derby时如何避免词法错误? [英] How to avoid the lexical error when input data to derby?
本文介绍了输入数据到derby时如何避免词法错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一些常规模式值要保存在derby中。它包含了很多在德比中提到的定界字母。如何将这些数据输入到德比中?
I have some regular patterns values to be saved in derby. it includes a lot of delimited letter mentioned in the derby. How could I input this data to the derby?
insert into configuration_master (PROPERTY_ID,PROPERTY_KEY, PROPERTY_VALUE, PROPERTY_NAME , PROPERTY_DESCRIPTION , PROPERTY_VALIDATION ,CATEGORY_1,CATEGORY_2,CATEGORY_3,FST_REG_DT,FNL_AMD_DT ) values( 'agent.dependency.urlpatterns','agent.dependency.urlpatterns',"
\(\s*['"]#target['"]\s*\)\.attr\(\s*['"]action['"]\s*,['"]([\w]+\.do)['"]\)
\.attr\(\s*['"]action['"]\s*\,\s*['"]([\w_/\?\=\&]+)['"]\s*\)
a.href\s*\=\s*['"]([\w_/\?\=\&]+)['"]
[\. ]action\s*\=\s*['"]([\w_/\?\=\&]+)['"]
['"]((/[\w\._]+)*/[\w\._]+\.do)['"]
['"]\S*\.html['"]
(action|value|href)\s*=\s*['"]((\/[a-zA-Z0-9\$\{\}?=.]+){2,3})\/?['"]
",'agent.dependency.urlpatterns','','','DEFAULT','DEFAULT','DEFAULT','','')
推荐答案
我不会通过您的可怕的正则表达式并修复所有问题,但是如果您确实希望将其插入数据库中,则:
I'm not going to through that hideous regexp of yours and fix it all, but if you do want to insert it into your database, then:
- 使用单引号(
'
)包围整个正则表达式字符串。目前,您正在使用双引号( -
在字符串中使用两个单引号表示一个单引号字符串中的-quote字符。例如
- Use single quotes (
'
) to surround the entire regexp string. At the moment you are using double quotes ("
). Use two single quotes inside a string to represent a single-quote character within the string. For example
SELECT 'Don't do this' FROM some_table
会因错误而失败,但是
SELECT 'It''s better to do this' FROM some_table
将选择字符串最好这样做。
这篇关于输入数据到derby时如何避免词法错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文