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

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Talend open studio for DQ: Regex pattern ^.{50}$ does not match when field begins or ends with spaces. Why??

I’m new to talend and trying to use the profiler tool to analyse data in a csv file. Values in one of the columns in the file has to be exactly 50 characters long (any characters allowed, even spaces should be included).

I’ve tried regex patterns ^.{50}$ and ^[\S\s]{50}$ but I don’t get matches when a value in the column begins and/or ends with spaces (total characters including the spaces are 50 when I’m testing - but no match). Anyone who has an idea why?

Labels (3)
2 Replies
Anonymous
Not applicable
Author

Hello,

If we understand your requirement very well, maybe you could try ^[a-zA-Z,]{1,50}$

We will appreciate it if you could post your input data sample content here.

Elaborating your case with an example with input and expected output values will be preferred.

Best regards

Sabrina

 

Anonymous
Not applicable
Author

Hi Sabrina, thanks for your response

 

So I want to make sure the value in the column is EXACTLY 50 characters. That is the goal with this expression. I believe your regex matches only letters a-z, A-Z with minimum 1 and max 50.

 

I want it to match for example:

' gggdhfjgkdlj jhdgsyru odk837<o +d-sgayr29l sjflm ' (50 characters with space in the beginning and end)

'                                                aa' (50 characters with 48 spaces in the beginning)

'aa                                                ' (50 characters with 48 spaces in the end)

 

I don't want to match values in a column that contains more than 50 characters. Does that make sense?

 

However, using the regex in my original post, in Talend, only matches values that start AND end with a character that is NOT a space. E.g.

'pfagdhfjgkdlj jhdgsyru odk837<o +d-sgayr29l sjflmo' (50 characters with a non-space character in the beginning and end)

'a                                               aa' (50 characters with a non-space character in the beginning and end)

'aa                                               a' (50 characters with a non-space character in the beginning and end)

 

Appreciate your help!