@@ -1489,6 +1489,111 @@ fn document_node_definitions() -> HashMap<DefinitionIdentifier, DocumentNodeDefi
14891489 description: Cow :: Borrowed ( "TODO" ) ,
14901490 properties: None ,
14911491 } ,
1492+ DocumentNodeDefinition {
1493+ identifier: "Regex Find" ,
1494+ category: "Text" ,
1495+ node_template: NodeTemplate {
1496+ document_node: DocumentNode {
1497+ implementation: DocumentNodeImplementation :: Network ( NodeNetwork {
1498+ exports: vec![
1499+ // Primary output: the whole match (String)
1500+ NodeInput :: node( NodeId ( 1 ) , 0 ) ,
1501+ // Secondary output: capture groups (Vec<String>)
1502+ NodeInput :: node( NodeId ( 2 ) , 0 ) ,
1503+ ] ,
1504+ nodes: [
1505+ // Node 0: regex_find proto node — returns Vec<String> of [whole_match, ...capture_groups]
1506+ DocumentNode {
1507+ inputs: vec![
1508+ NodeInput :: import( concrete!( String ) , 0 ) ,
1509+ NodeInput :: import( concrete!( String ) , 1 ) ,
1510+ NodeInput :: import( concrete!( f64 ) , 2 ) ,
1511+ NodeInput :: import( concrete!( bool ) , 3 ) ,
1512+ NodeInput :: import( concrete!( bool ) , 4 ) ,
1513+ ] ,
1514+ implementation: DocumentNodeImplementation :: ProtoNode ( logic:: regex_find:: IDENTIFIER ) ,
1515+ ..Default :: default ( )
1516+ } ,
1517+ // Node 1: index_elements at index 0 — extracts the whole match as a String
1518+ DocumentNode {
1519+ inputs: vec![ NodeInput :: node( NodeId ( 0 ) , 0 ) , NodeInput :: value( TaggedValue :: F64 ( 0. ) , false ) ] ,
1520+ implementation: DocumentNodeImplementation :: ProtoNode ( graphic:: index_elements:: IDENTIFIER ) ,
1521+ ..Default :: default ( )
1522+ } ,
1523+ // Node 2: omit_element at index 0 — returns capture groups as Vec<String>
1524+ DocumentNode {
1525+ inputs: vec![ NodeInput :: node( NodeId ( 0 ) , 0 ) , NodeInput :: value( TaggedValue :: F64 ( 0. ) , false ) ] ,
1526+ implementation: DocumentNodeImplementation :: ProtoNode ( graphic:: omit_element:: IDENTIFIER ) ,
1527+ ..Default :: default ( )
1528+ } ,
1529+ ]
1530+ . into_iter( )
1531+ . enumerate( )
1532+ . map( |( id, node) | ( NodeId ( id as u64 ) , node) )
1533+ . collect( ) ,
1534+ ..Default :: default ( )
1535+ } ) ,
1536+ inputs: vec![
1537+ NodeInput :: value( TaggedValue :: String ( String :: new( ) ) , true ) ,
1538+ NodeInput :: value( TaggedValue :: String ( String :: new( ) ) , false ) ,
1539+ NodeInput :: value( TaggedValue :: F64 ( 0. ) , false ) ,
1540+ NodeInput :: value( TaggedValue :: Bool ( false ) , false ) ,
1541+ NodeInput :: value( TaggedValue :: Bool ( false ) , false ) ,
1542+ ] ,
1543+ ..Default :: default ( )
1544+ } ,
1545+ persistent_node_metadata: DocumentNodePersistentMetadata {
1546+ input_metadata: vec![
1547+ ( "String" , "The string to search within." ) . into( ) ,
1548+ ( "Pattern" , "The regular expression pattern to search for." ) . into( ) ,
1549+ (
1550+ "Match Index" ,
1551+ "Which occurrence of the pattern to return (0 for the first). Negative indices count from the last match." ,
1552+ )
1553+ . into( ) ,
1554+ ( "Case Insensitive" , "Match letters regardless of case." ) . into( ) ,
1555+ ( "Multiline" , "Make `^` and `$` match the start and end of each line, not just the whole string." ) . into( ) ,
1556+ ] ,
1557+ output_names: vec![ "Match" . to_string( ) , "Captures" . to_string( ) ] ,
1558+ network_metadata: Some ( NodeNetworkMetadata {
1559+ persistent_metadata: NodeNetworkPersistentMetadata {
1560+ node_metadata: [
1561+ DocumentNodeMetadata {
1562+ persistent_metadata: DocumentNodePersistentMetadata {
1563+ node_type_metadata: NodeTypePersistentMetadata :: node( IVec2 :: new( 0 , 0 ) ) ,
1564+ ..Default :: default ( )
1565+ } ,
1566+ ..Default :: default ( )
1567+ } ,
1568+ DocumentNodeMetadata {
1569+ persistent_metadata: DocumentNodePersistentMetadata {
1570+ node_type_metadata: NodeTypePersistentMetadata :: node( IVec2 :: new( 8 , -2 ) ) ,
1571+ ..Default :: default ( )
1572+ } ,
1573+ ..Default :: default ( )
1574+ } ,
1575+ DocumentNodeMetadata {
1576+ persistent_metadata: DocumentNodePersistentMetadata {
1577+ node_type_metadata: NodeTypePersistentMetadata :: node( IVec2 :: new( 8 , 2 ) ) ,
1578+ ..Default :: default ( )
1579+ } ,
1580+ ..Default :: default ( )
1581+ } ,
1582+ ]
1583+ . into_iter( )
1584+ . enumerate( )
1585+ . map( |( id, node) | ( NodeId ( id as u64 ) , node) )
1586+ . collect( ) ,
1587+ ..Default :: default ( )
1588+ } ,
1589+ ..Default :: default ( )
1590+ } ) ,
1591+ ..Default :: default ( )
1592+ } ,
1593+ } ,
1594+ description: Cow :: Borrowed ( "Finds a regex match in the string. The primary output is the whole match, and the secondary output is the list of capture groups." ) ,
1595+ properties: None ,
1596+ } ,
14921597 // Aims for interoperable compatibility with:
14931598 // https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#:~:text=levl%27%20%3D%20Levels-,%27curv%27%20%3D%20Curves,-%27expA%27%20%3D%20Exposure
14941599 // https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#:~:text=Max%20input%20range-,Curves,-Curves%20settings%20files
0 commit comments