[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 198
  • Last Modified:

Need a regular expression

Hi all,

I need a regular expression that trunctates a string.

For example "0123456TUV" becomes "123456tuv"
Or
01230023FVF becomes 1230023FVF

Thanks
0
ram_os
Asked:
ram_os
  • 3
  • 3
1 Solution
 
ramiseesniblicCommented:
It looks like you are just dropping the 1st digit of the string.

Can you be more specific?
0
 
ram_osAuthor Commented:

Sure, sorry if my question is unclear.

I just want to the leading zeros from the string, there can be o or many zeros.

Hope this makes sense,

Thanks
0
 
ram_osAuthor Commented:


>>I just want to the leading zeros from the string, there can be o or many zeros.

Should be

I just want to REMOVE the leading zeros from the string, there can be o or many zeros.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
ramiseesniblicCommented:
Right, try this:


s = s.replaceAll("^0*", "")

Open in new window

0
 
ram_osAuthor Commented:

Works a treat, thanks!
0
 
ramiseesniblicCommented:
No problem.  Have fun!
0

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now