jquery sortable with regexp

Posted by Chris Lively on Stack Overflow See other posts from Stack Overflow or by Chris Lively
Published on 2010-05-28T18:30:44Z Indexed on 2010/05/28 18:31 UTC
Read the original article Hit count: 262

Filed under:
|

I am trying to figure out the right regexp to match on list item id's.

For example:

<ul id="MyList" class="connectedSortable">
    <li id="id=1-32">Item 1</li>
    <li id="id=2_23">Item 2</li>
    <li id="id=3">Item 3</li>
    <li id="id=4">Item 4</li>
    <li id="id=5">Item 5</li>
    <li id="id=6">Item 6</li>
</ul>

On the serialize method, I want it to pull everything after the equal sign (=)

    $(function () {
        $("#MyList, #OtherList").sortable({
            connectWith: '.connectedSortable',
            update: function () {
                $("#MyListOrder").val($("#MyList").sortable('serialize', { regexp: '/(.+)[=](.+)/)' }));
            }
        }).disableSelection();
    });

I tried the above, but that didn't quite work. My regexp expression is wrong and I don't know what it should be. Ideas?

© Stack Overflow or respective owner

Related posts about regex

Related posts about jquery-ui