Solved Remove text Prefix from a number (1 Viewer)

Number11

Member
Local time
Today, 22:53
Joined
Jan 29, 2020
Messages
607
Hi

So i need to remove the prefixed number from "ACC/0014471211" to "0014471211"

whats the best way to do this with a query?
 

ebs17

Well-known member
Local time
Today, 23:53
Joined
Feb 7, 2020
Messages
1,946
Code:
Mid(XExpression, 5)
'------
RegExReplace(XExpression, ".*(\d+)", "$1")
 

XPS35

Active member
Local time
Today, 23:53
Joined
Jul 19, 2022
Messages
159
That depends on whether the prefix is always the same number of positions long. And if that is not the case, then it always ends with a /?
 

Number11

Member
Local time
Today, 22:53
Joined
Jan 29, 2020
Messages
607
That depends on whether the prefix is always the same number of positions long. And if that is not the case, then it always ends with a /?

Its always the same and position
 

XPS35

Active member
Local time
Today, 23:53
Joined
Jul 19, 2022
Messages
159
Eberhards solution (MID) will do.
 

Number11

Member
Local time
Today, 22:53
Joined
Jan 29, 2020
Messages
607
ok thanks got it working now using

AccountRef: Mid([Account_No],5)
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 22:53
Joined
Sep 12, 2006
Messages
15,658
Hi

So i need to remove the prefixed number from "ACC/0014471211" to "0014471211"

whats the best way to do this with a query?

I take it you realise that your "number" is a text string, not a number. You may have to be careful that "0014471211" doesn't get treated as just 14471211 in some cases.

Also that the value doesn't exceed the max value of a longint (approx 2 billion) which might produce a different type of error.
 

Users who are viewing this thread

Top Bottom