Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
1

Regular Expression

Community Expert ,
Dec 09, 2023 Dec 09, 2023

How do I write a regular expression to replace everything after the 2nd occurrence of a period?

1.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Expert ,
Dec 10, 2023 Dec 10, 2023
LATEST

Ah OK. I think a Regular Expression is a bit of an overkill for that.
You can do it using this code:

 

var s = "123.456.78910.1234";
var parts = s.split(".");
var newS = (parts.length<2) ? parts[0] : parts[0]+"."+parts[1];
console.println(newS);

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 09, 2023 Dec 09, 2023

what app? acrobat? animate? something else?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 09, 2023 Dec 09, 2023

Acrobat (JavaScript)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 09, 2023 Dec 09, 2023

in the future, to find the best place to post your message, use the list here, https://community.adobe.com/

p.s. i don't think the adobe website, and forums in particular, are easy to navigate, so don't spend a lot of time searching that forum list. do your best and we'll move the post (like this one has already been moved) if it helps you get responses.



<"moved from using the community">
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 09, 2023 Dec 09, 2023

All of your previous messages are in Acrobat About formsdoctor - Adobe Community

 

Is this another Acrobat message?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 09, 2023 Dec 09, 2023

Yes

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 09, 2023 Dec 09, 2023

Replace it with what?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 09, 2023 Dec 09, 2023

Remove it.  Replace with ""

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 10, 2023 Dec 10, 2023
LATEST

Ah OK. I think a Regular Expression is a bit of an overkill for that.
You can do it using this code:

 

var s = "123.456.78910.1234";
var parts = s.split(".");
var newS = (parts.length<2) ? parts[0] : parts[0]+"."+parts[1];
console.println(newS);
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines