AngelBenitez Posted July 18, 2023 Share Posted July 18, 2023 Hello, I am trying to create a rule that does the following: Removes the Roman numerals from the job title Example Text: Digtal Media Specialist III Loan Documentation Specialist II Output: Digital Media Specialist Loan Documentation Specialist Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted July 19, 2023 Share Posted July 19, 2023 This is another one you could Google for, something like "javascript strip roman numerals." Assuming that the Roman numerals are at the end of the string, and that they're numbers less than 90, then it's pretty simple: var s = "Digtal Media Specialist III"; // field value etc. return s.replace(/\s*[IVXL]+$/, ''); Quote Link to comment Share on other sites More sharing options...
AngelBenitez Posted July 19, 2023 Author Share Posted July 19, 2023 Hello @Dan Korn; thank you for your help. If the value is being pulled from an Excel sheet, what would be the rule to remove the variable in the Excel sheet? Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted July 19, 2023 Share Posted July 19, 2023 51 minutes ago, AngelBenitez said: Hello @Dan Korn; thank you for your help. If the value is being pulled from an Excel sheet, what would be the rule to remove the variable in the Excel sheet? You would just call the Field function to grab the value from the named data field, for Excel or any other input data format, something like this: var s = Field("Title"); return s.replace(/\s*[IVXL]+$/, ''); Or if it's from an XDF, something like: var s = XDF.GetFieldValue(recordNum, "Title"); Quote Link to comment Share on other sites More sharing options...
AngelBenitez Posted July 19, 2023 Author Share Posted July 19, 2023 Hello @Dan Korn, thank you so much for your help. I really appreciate it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.