Tips and tricks

How to convert a javascript object with comments into a explanation table ? ( with RegEx )

This is the regex

javascript

[\s|\S](?:.)([a-z].*?):.*// --(.*?)\n

php

(.*?)=>.*,.*\/\/ --(.*?)(\n|$)

replace with

<tr><td><strong>$1</strong></td><td>$2</td></tr>\n

This makes this text:

  , enable_embed_button: 'off' // -- enable the embed button
  , embed_code: '' // -- embed code
  , skinwave_dynamicwaves: 'off' // -- dynamic scale based on volume for no spectrum wave
  , soundcloud_apikey: '' // -- set the sound cloud api key
  , parentgallery: null // -- the parent gallery of the player
  , skinwave_enableSpectrum: 'off' // -- off or on
  , skinwave_enableReflect: 'on'  // -- (deprecated)
  , skinwave_place_thumb_after_volume: 'off' // -- place the thumbnail after volume button
  , skinwave_place_metaartist_after_volume: 'off' // -- place metaartist after volume button
  , settings_useflashplayer: 'auto' // -- off or on or auto
  , skinwave_spectrummultiplier: '1' // -- (deprecated) number
  , settings_php_handler: '' // -- the path of the publisher.php file, this is used to handle comments, likes etc.
  , php_retriever: 'soundcloudretriever.php' // -- the soundcloud php file used to render soundcloud files
  , skinwave_mode: 'normal' // --- "normal" or "small" or "alternate"
  , skinwave_wave_mode: 'canvas' // --- "normal" or "canvas" or "line"
  , skinwave_wave_mode_canvas_mode: 'normal' // -- "normal" or "reflecto"
  , skinwave_wave_mode_canvas_normalize: 'on' // -- normalize wave to look more natural
  , skinwave_wave_mode_canvas_waves_number: '3' // -- the number of waves in the canvas ( "1" pixel waves, "2" 2 pixel width waves, "3" 3 pixel width waves, "anything more then 3" means number of waves in the container, for example 100 means 100 waves in 1000px container if the container is 1000px width )
  , skinwave_wave_mode_canvas_waves_padding: '1' // -- padding between waves ( "1" 1 pixel between < - > "0" no reflection )
  , skinwave_wave_mode_canvas_reflection_size: '0.25' // -- the reflection size ( "1" full size < - > "0" no reflection )
  , wavesurfer_pcm_length: '200' // -- define the precision of the wave generation; higher is more precise, but occupies more space
  

Look like this

  <tr><td><strong> enable_embed_button</strong></td><td> enable the embed button</td></tr>  <tr><td><strong> embed_code</strong></td><td> embed code</td></tr>  <tr><td><strong> skinwave_dynamicwaves</strong></td><td> dynamic scale based on volume for no spectrum wave</td></tr>  <tr><td><strong> soundcloud_apikey</strong></td><td> set the sound cloud api key</td></tr>  <tr><td><strong> parentgallery</strong></td><td> the parent gallery of the player</td></tr>  <tr><td><strong> skinwave_enableSpectrum</strong></td><td> off or on</td></tr>  <tr><td><strong> skinwave_enableReflect</strong></td><td> (deprecated)</td></tr>  <tr><td><strong> skinwave_place_thumb_after_volume</strong></td><td> place the thumbnail after volume button</td></tr>  <tr><td><strong> skinwave_place_metaartist_after_volume</strong></td><td> place metaartist after volume button</td></tr>  <tr><td><strong> settings_useflashplayer</strong></td><td> off or on or auto</td></tr>  <tr><td><strong> skinwave_spectrummultiplier</strong></td><td> (deprecated) number</td></tr>  <tr><td><strong> settings_php_handler</strong></td><td> the path of the publisher.php file, this is used to handle comments, likes etc.</td></tr>  <tr><td><strong> php_retriever</strong></td><td> the soundcloud php file used to render soundcloud files</td></tr>  <tr><td><strong> skinwave_mode</strong></td><td>- "normal" or "small" or "alternate"</td></tr>  <tr><td><strong> skinwave_wave_mode</strong></td><td>- "normal" or "canvas" or "line"</td></tr>  <tr><td><strong> skinwave_wave_mode_canvas_mode</strong></td><td> "normal" or "reflecto"</td></tr>  <tr><td><strong> skinwave_wave_mode_canvas_normalize</strong></td><td> normalize wave to look more natural</td></tr>  <tr><td><strong> skinwave_wave_mode_canvas_waves_number</strong></td><td> the number of waves in the canvas ( "1" pixel waves, "2" 2 pixel width waves, "3" 3 pixel width waves, "anything more then 3" means number of waves in the container, for example 100 means 100 waves in 1000px container if the container is 1000px width )</td></tr>  <tr><td><strong> skinwave_wave_mode_canvas_waves_padding</strong></td><td> padding between waves ( "1" 1 pixel between < - > "0" no reflection )</td></tr>  <tr><td><strong> skinwave_wave_mode_canvas_reflection_size</strong></td><td> the reflection size ( "1" full size < - > "0" no reflection )</td></tr>  <tr><td><strong> wavesurfer_pcm_length</strong></td><td> define the precision of the wave generation; higher is more precise, but occupies more space</td></tr>  
{"type":"main_options","images_arr":"'#ffffff'","enable_ajax":"off","soundcloud_apikey":"","bg_isparallax":"off","bg_slideshow_time":"0","bg_transition":"slidedown","site_url":"https:\/\/digitalzoomstudio.net","theme_url":"https:\/\/digitalzoomstudio.net\/wp-content\/themes\/qucreative\/","blur_ammount":"26","width_column":"50","width_section_bg":"","width_gap":"30","border_width":"0","border_color":"#ffffff","translate_cancel_comment":"Cancel reply","translate_leave_a_comment":"Leave a comment","translate_leave_a_comment_to":"Leave a comment to","is_customize_preview":"off","width_blur_margin":"30","gallery_w_thumbs_autoplay_videos":"off","content_enviroment_opacity":"30","menu_enviroment_opacity":"70","base_url":"https:\/\/digitalzoomstudio.net"}
{"type":"darkfull"}