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

Regular Expression

Participant ,
Dec 09, 2023 Dec 09, 2023

Copy link to clipboard

Copied

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

Views

268

Translate

Translate

Report

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

correct answers 1 Correct answer

Community Expert , Dec 10, 2023 Dec 10, 2023

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);

Votes

Translate

Translate
Community Expert ,
Dec 09, 2023 Dec 09, 2023

Copy link to clipboard

Copied

what app? acrobat? animate? something else?

Votes

Translate

Translate

Report

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
Participant ,
Dec 09, 2023 Dec 09, 2023

Copy link to clipboard

Copied

Acrobat (JavaScript)

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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">

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

 

Is this another Acrobat message?

Votes

Translate

Translate

Report

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
Participant ,
Dec 09, 2023 Dec 09, 2023

Copy link to clipboard

Copied

Yes

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

Replace it with what?

Votes

Translate

Translate

Report

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
Participant ,
Dec 09, 2023 Dec 09, 2023

Copy link to clipboard

Copied

Remove it.  Replace with ""

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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);

Votes

Translate

Translate

Report

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