MATLAB Answers

help useing regexp to extract text from a string

2 views (last 30 days)
I have a string that I extracted from a pdf
"↵↵↵1. Receptacles, general purpose. ↵2. Receptacles with integral GFCI. ↵3. USB Charger receptacles. ↵4. AFCI receptacles. ↵5. Twist-locking receptacles. ↵6. Isolated-ground receptacles. ↵7. Tamper-resistant receptacles. ↵8. Weather-resistant receptacles. ↵9. Pendant cord-connector devices. ↵10. Cord and plug sets. ↵11. Wall box dimmers. ↵12. Wall box dimmer/sensors. ↵13. Wall box occupancy/vacancy sensors. ↵14. Toggle Switches. ↵15. Floor service outlets. ↵16. Associated device plates. ↵↵"
How can I use the function regexp to extract all the descriptions after the numbers to put them into a 16x1 matrix. So the end product I want will be a 16x1 string that looks like
  1. Receptacles, general purpose.
  2. Receptacles with integral GFCI.
  3. USB Charger receptacles.
  4. AFCI receptacles.
  5. Twist-locking receptacles.
  6. Isolated-ground receptacles.
  7. Tamper-resistant receptacles.
  8. Weather-resistant receptacles.
  9. Pendant cord-connector devices.
  10. Cord and plug sets.
  11. Wall box dimmers.
  12. Wall box dimmer/sensors.
  13. Wall box occupancy/vacancy sensors.
  14. Toggle Switches.
  15. Floor service outlets.
  16. Associated device plates.

  0 Comments

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 8 Nov 2019
parts = regexp(S, '^\d+.*$', 'dotexceptnewline', 'lineanchors');

  0 Comments

Sign in to comment.

More Answers (0)


Translated by