How can I create a custom html tag in the CKeditor wysiwyg editor? I've created a custom HTML tag that pulls information from my database and displays it. Basically it uses preg_match_all to parse the body of articles for &lt;profiletag&gt;Person Name&lt;/profiletag&gt; and replaces this tag with html of the person's profile.

Now what I want is to allow my writers to insert this HTML (&lt;profiletag&gt;Person Name&lt;/profiletag&gt;) from the WYSIWYG editor rather than having to go into the source and insert a tag into the html. When they write &lt;profiletag&gt; etc. in the WYSIWYG editor obviously it gets all messed up. I'm looking for something like [profile]Person Name[/profile] markup for them to include these tags in the WYSIWYG side.

Is this possible, and if so how can I implement this functionality?
What you need is a custom filter. Filters are the check boxes you can set on input formats like 'Filtered HTML' and 'Full HTML'.

There is an example available in the examples module: https://www.drupal.org/project/examples

Basically, you need this:

1) You need to implement hook_filter_info() to let Drupal know there is a new filter
2) You need to a function to process the input. This is where you can use your regex.

I highly suggest looking at the examples module or any other modules that use filters.