Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

deletion of a regex

Hi,

 

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

 

- my expression to transform

 

0683p000009LwHU.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,

 

 

Labels (4)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

If you're searching for alphanumeric, try replacing  

[[:xdigit:]]+

with 

[a-zA-Z0-9]+

 

View solution in original post

5 Replies
TRF
Champion II
Champion II

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.
Anonymous
Not applicable
Author

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.

Anonymous
Not applicable
Author

If you're searching for alphanumeric, try replacing  

[[:xdigit:]]+

with 

[a-zA-Z0-9]+

 

cterenzi
Specialist
Specialist

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 

Anonymous
Not applicable
Author

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 !