Six Stars

deletion of a regex

Hi,

 

During my searching, I would like a piece of advice on this regex :

 

- my expression to transform

 

image.png

- I would like to use this expression in the componant TJavaRow :

 

output_row.json = output_row.json.replaceAll("\"created\":\"[[:xdigit:]]+\"","‌​");

But It doesn't work. I have still the same string.

 

However It works under regex101.com

https://regex101.com/r/nCuUCs/1

 

Why ? I would like to understand ?

 

Thanks,

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Six Stars

Re: deletion of a regex

If you're searching for alphanumeric, try replacing  

[[:xdigit:]]+

with 

[a-zA-Z0-9]+

 

5 REPLIES
Twelve Stars TRF
Twelve Stars

Re: deletion of a regex

Did you try to remove + signe from the regex giving :
output_row.json = output_row.json.replaceAll("\"created\":\"[[:xdigit:]]\"","‌​");
I did try but I think it should not be there.

Hope this helps.

TRF
Six Stars

Re: deletion of a regex

Hi,

 

I try to remove the + sign but It is always the same result.

 

With https://regex101.com/r/nCuUCs/2, It's false when you remove the "+" unfortunately.

Six Stars

Re: deletion of a regex

If you're searching for alphanumeric, try replacing  

[[:xdigit:]]+

with 

[a-zA-Z0-9]+

 

Ten Stars

Re: deletion of a regex

That's not the Java pattern syntax for xdigit.  Try:

replaceAll("\"created\":\"[\\p{XDigit}]+\"","‌​")

 

To test regular expressions in Java, try http://www.regexplanet.com/advanced/java/index.html 

Six Stars

Re: deletion of a regex

Hi,

 

Got It ! The first solution works for me ; I tested It.

 

For the second, I have this error :

Exécution en erreur :Erreurs de compilation du Job 
Au moins le Job "ecriture_du_json_DE_LA_TACHE_COMPLETE_pour_le_composant_jira" a des erreurs de compilation, réparez et réexportez.
Ligne en erreur: 1879
Message détaillé: The method replaceAll(String, String) is undefined for the type ecriture_du_json_DE_LA_TACHE_COMPLETE_pour_le_composant_jira
Il peut y avoir d'autres erreurs causées par la compatibilité avec la JVM. Vérifiez que les paramètres de votre JVM sont les mêmes que dans le studio.
Job ecriture_du_json_DE_LA_TACHE_COMPLETE_pour_le_composant_jira terminé à 16:00 01/08/2017. [Code sortie=0]

Thanks very this link cterenzi

 

The topic is closed for me !

 

See you soon !