Find first non-numerical character in a string

0
I have a string field that contains house numbers. It contains both the house number and the extension. I need to split his into 2 fields: house number and house number extension. The data is a bit messy, there are valus like: '7A/7B'. So a replaceAll will not work without somethign extra. What I am trying to do is get a substring with the first numerical characters from the string. For that I need to be able to find the first non-numerical charater. How can I solve this? I've tried it with a regular expression, but it doesn't seem to work like this: parseInteger(substring($IT_Opleidingsinstelling/Conversiehuisnummer,0,find($IT_Opleidingsinstelling/Conversiehuisnummer, '([^0-9])')))
asked
2 answers
3

Find does n't use regular expressions. You can do it the other way around. If you want the numerics, remove the non-numeric with

replaceFirst($Nummer, '([A-Za-z]+)', '')

if you want the non-numeric characters

replaceFirst($Nummer, '([0-9]+)', '')
answered
1

You can try Regular Expressions, although I think you'll have to resort to Java to actually get the value from the attribute.

Something like this I suppose:

    String regex = "^[^0-9]*([0-9]*).*$";

    String test = "some words 234 and more 678";
    Pattern pattern = Pattern.compile(regex);
    Matcher matcher = pattern.matcher(test);
    matcher.matches();
    System.out.println(matcher.group(1));
answered