- Correction d'erreur de syntaxe dans la composition d'expressions régulières

This commit is contained in:
Benjamin Renard 2008-07-28 17:06:40 +00:00
parent 1228e42fc7
commit dd5815ee8f
2 changed files with 5 additions and 5 deletions

View file

@ -24,14 +24,14 @@ var LSformElement_text = new Class({
getDependsFields: function(format) { getDependsFields: function(format) {
var retval=new Array(); var retval=new Array();
var find = 1; var find = 1;
var getMotif = /%{([A-Za-z0-9]+)}/ var getMotif = new RegExp('%\{([A-Za-z0-9]+)\}');
var ch = null; var ch = null;
while (find) { while (find) {
ch = getMotif.exec(format); ch = getMotif.exec(format);
if ($type(ch)) { if ($type(ch)) {
retval.include(ch[1]); retval.include(ch[1]);
format=format.replace ( format=format.replace (
new RegExp('%{'+ch[1]+'}'), new RegExp('%\{'+ch[1]+'\}'),
'' ''
); );
} }

View file

@ -34,7 +34,7 @@ function LSdebug() {
* @retval string La chaine formatée * @retval string La chaine formatée
*/ */
function getFData(format,data,meth) { function getFData(format,data,meth) {
var getMotif = /%{([A-Za-z0-9]+)}/ var getMotif = new RegExp('%\{([A-Za-z0-9]+)\}');
var find=1; var find=1;
if(($type(data)=='object') || ($type(data)=='array')) { if(($type(data)=='object') || ($type(data)=='array')) {
if ($type(data[meth])!='function') { if ($type(data[meth])!='function') {
@ -42,7 +42,7 @@ function getFData(format,data,meth) {
var ch = getMotif.exec(format); var ch = getMotif.exec(format);
if ($type(ch)) { if ($type(ch)) {
format=format.replace ( format=format.replace (
new RegExp('%{'+ch[1]+'}'), new RegExp('%\{'+ch[1]+'\}'),
data[ch[1]] data[ch[1]]
); );
} }
@ -57,7 +57,7 @@ function getFData(format,data,meth) {
if ($type(ch)) { if ($type(ch)) {
try { try {
format=format.replace ( format=format.replace (
new RegExp('%{'+ch[1]+'}'), new RegExp('%\{'+ch[1]+'\}'),
data[meth](ch[1]) data[meth](ch[1])
); );
} }