• Intro Headers Instructions Macros Commands
Fork me on GitHub
    • Getting Started
      • Introduction
      • How to install bnd
      • Guided Tour Workspace & Projects
      • bnd / bndlib Features and JAR Wrapping Techniques
      • FAQ - Frequently Asked Questions
    • Concepts and Practices
      • Concepts
      • Background
      • Best practices
    • Build and Development
      • Build
      • Generating JARs
      • Versioning
      • Baselining
      • Service Components
      • Metatype
      • Contracts
      • Bundle Annotations
      • Accessor Properties
      • SPI Annotations
    • Dependency and Launching
      • Resolving Dependencies
      • Launching
      • Startlevels
    • Testing
      • Testing
      • Testing with Launchpad
    • Packaging and Distribution
      • Packaging Applications
      • JPMS Libraries
      • Wrapping Libraries to OSGi Bundles
    • Documentation and Tools
      • Generating Documentation
      • bnd CLI Commands
      • For Developers
      • Templates for Workspaces
      • Tips for Windows users
      • Tools bound to bnd
    • Reference Material
      • Reference
      • Headers
      • Instruction Reference
      • Instruction Index
      • Macro Reference
      • Macro Index
      • Plugins
      • External Plugins
    • Configuration and Troubleshooting
      • Settings
      • Errors
      • Warnings
  • select ';' LIST ';' REGEX

    Prev Next
    Macro
    Selects entries in a list that matching a regular expression

    Summary

    Filter a list to include only elements that match a regular expression. This macro is an alias for the filter macro.

    Syntax

    ${select;<list>;<regex>}
    

    Parameters

    • list: Comma-separated list of elements to filter
    • regex: Regular expression pattern to match against

    Behavior

    Returns a new list containing only the elements from the input list that match the specified regular expression pattern.

    This macro is functionally identical to filter.

    Examples

    # Select items starting with "com."
    packages = com.example.api, org.sample.impl, com.example.util
    ${select;${packages};com\..*}
    # Returns: com.example.api,com.example.util
    
    # Select files with specific extension
    files = foo.jar, bar.txt, baz.jar
    ${select;${files};.*\.jar}
    # Returns: foo.jar,baz.jar
    
    # Select numbered items
    items = item1, item2, other, item3
    ${select;${items};item\d+}
    # Returns: item1,item2,item3
    
    # Select packages matching pattern
    -conditionalpackage: ${select;${packages};com\.company\.internal\..*}
    

    Use Cases

    1. Package Filtering: Select packages matching a naming pattern
    2. File Selection: Filter file lists by extension or pattern
    3. Dependency Filtering: Select specific dependencies from a larger list
    4. Pattern Matching: Include only items matching a specific format

    Notes

    • This is an alias for the filter macro - they behave identically
    • Uses Java regular expression syntax
    • Elements are matched in their entirety (use .* for partial matching)
    • The opposite operation is provided by reject or filterout

    Related Macros

    • filter - Identical functionality (primary name)
    • reject / filterout - Exclude elements matching regex
    • removeall - Remove specific elements from a list
    • retainall - Keep only elements present in another list

    TODO Needs review - AI Generated content


    See test cases in MacroTestsForDocsExamples.java

Prev Next
Search
    • Home