re = /<\/?(\d)/
str = '<?xml version="1.0"?>
<data>
<client_name>Awesome Client</client_name>
<account_number/>
<date_created>02/12/2016</date_created>
<form_number>4126</form_number>
<customer_po/>
<terms_name>Credit Card</terms_name>
<date_shipped>12/31/1969</date_shipped>
<billing_contact_email/>
<billing_contact_address_line_1/>
<billing_contact_address_line_2/>
<billing_contact_address_line_3/>
<billing_contact_address_line_4/>
<billing_contact_address_city/>
<billing_contact_address_state>British Columbia</billing_contact_address_state>
<billing_contact_address_postal/>
<billing_contact_address_country>Canada</billing_contact_address_country>
<shipping_contact_address_line_1/>
<shipping_contact_address_line_2/>
<shipping_contact_address_line_3/>
<shipping_contact_address_line_4/>
<shipping_contact_address_city/>
<shipping_contact_address_state>British Columbia</shipping_contact_address_state>
<shipping_contact_address_postal/>
<shipping_contact_address_country>Canada</shipping_contact_address_country>
<billing_contact_first_name>another</billing_contact_first_name>
<billing_contact_last_name>client</billing_contact_last_name>
<client_rep_full_name>Rob Montebelli</client_rep_full_name>
<order_rep_full_name>Mark Graham</order_rep_full_name>
<job_name>77777</job_name>
<job_number>2620</job_number>
<event_type>Donor Gift</event_type>
<due_date>02/12/2016</due_date>
<shipping_method/>
<currency>CAD</currency>
<total_taxes>0.00</total_taxes>
<total_subtotal>1,760.16</total_subtotal>
<total>1,760.16</total>
<items>
<item0>
<taxes>
<0>E</0>
</taxes>
<title>1889-24</title>
<quantity>6</quantity>
<description>Carhartt (R) Signature Utility Duffel; TBD TBD</description>
<unit_price>159.32</unit_price>
</item0>
<item1>
<taxes>
<0>E</0>
</taxes>
<title>0022-56</title>
<quantity>12</quantity>
<description>Zoom (TM) DayTripper Sling Compu-Messenger; TBD TBD</description>
<unit_price>67.02</unit_price>
</item1>
</items>
</data>'
subst = '<number$1'
result = str.gsub(re, subst)
# Print the result of the substitution
puts result
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html